Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.7

  • Loading branch information...
commit 8587c7acc040f6bc07cbff85ff14c6035f46b688 1 parent 4e564cf
@ugexe authored
View
4 Changes
@@ -1,5 +1,9 @@
Revision history for Perl module Text::Levenshtein::Damerau::XS
+1.7 Thu Dec 13 00:39:41
+ - Matching string check before calculations take place
+ - MIN_PERL_VERSION added back to Makefile using different number format
+
1.6 Thu Dec 06 15:52:57
- Minmum Perl version supported changed from 5.8.0 to 5.8.8
View
5 Makefile.PL
@@ -1,4 +1,4 @@
-use 5.8.8;
+use 5.008_008;
use strict;
use warnings;
use ExtUtils::MakeMaker;
@@ -7,12 +7,13 @@ my $pm = 'lib/Text/Levenshtein/Damerau/XS.pm';
my $repo = 'https://github.com/ugexe/Text--Levenshtein--Damerau--XS';
my $bugs = 'https://rt.cpan.org/Public/Dist/Display.html?Name=Text-Levenshtein-Damerau-XS';
-WriteMakefile (
+WriteMakefile (
NAME => 'Text::Levenshtein::Damerau::XS',
VERSION_FROM => $pm,
ABSTRACT_FROM => $pm,
AUTHOR => 'Nick Logan <ug@skunkds.org>',
LICENSE => 'perl',
+ MIN_PERL_VERSION => '5.008008',
PREREQ_PM => {
},
META_MERGE => {
View
17 XS.xs
@@ -131,7 +131,11 @@ CODE:
int arrTarget [ lenTarget ];
unsigned int lenSource2 = 0;
unsigned int lenTarget2 = 0;
-
+ int matchBool = 1;
+
+ if(lenSource != lenTarget)
+ matchBool = 0;
+
for (i=0; i < lenSource; i++) {
SV** elem = av_fetch(arraySource, i, 0);
int retval = (int)SvIV(*elem);
@@ -148,9 +152,18 @@ CODE:
if (elem != NULL) {
arrTarget[ j ] = retval;
lenTarget2++;
+
+ /* checks for match */
+ if(lenSource == lenTarget)
+ if(j <= lenSource)
+ if(arrSource[j] != arrTarget[j])
+ matchBool = 0;
}
}
- RETVAL = scores(arrSource,arrTarget,lenSource2,lenTarget2,(int)SvIV(maxDistance));
+ if(matchBool == 1)
+ RETVAL = 0;
+ else
+ RETVAL = scores(arrSource,arrTarget,lenSource2,lenTarget2,(int)SvIV(maxDistance));
OUTPUT:
RETVAL
View
5 lib/Text/Levenshtein/Damerau/XS.pm
@@ -1,11 +1,11 @@
package Text::Levenshtein::Damerau::XS;
-use 5.8.8;
+use 5.008_008;
require Exporter;
*import = \&Exporter::import;
require DynaLoader;
-$Text::Levenshtein::Damerau::XS::VERSION = '1.6';
+$Text::Levenshtein::Damerau::XS::VERSION = '1.7';
DynaLoader::bootstrap Text::Levenshtein::Damerau::XS $Text::Levenshtein::Damerau::XS::VERSION;
@@ -32,6 +32,7 @@ sub xs_edistance {
}
+
1;
=encoding utf8
Please sign in to comment.
Something went wrong with that request. Please try again.