From 087bd179e63f199105dabc8be0c8aebd087a178e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 20 Feb 2011 14:55:07 -0500 Subject: [PATCH] Minor logic fix for new levenshtein implementation. Alexander Korotkov --- contrib/fuzzystrmatch/Makefile | 3 +++ contrib/fuzzystrmatch/levenshtein.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/fuzzystrmatch/Makefile b/contrib/fuzzystrmatch/Makefile index 74728a30b5..834b679b10 100644 --- a/contrib/fuzzystrmatch/Makefile +++ b/contrib/fuzzystrmatch/Makefile @@ -16,3 +16,6 @@ top_builddir = ../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif + +# levenshtein.c is #included by fuzzystrmatch.c +fuzzystrmatch.o: fuzzystrmatch.c levenshtein.c diff --git a/contrib/fuzzystrmatch/levenshtein.c b/contrib/fuzzystrmatch/levenshtein.c index 30a517f5f9..3d85d4175f 100644 --- a/contrib/fuzzystrmatch/levenshtein.c +++ b/contrib/fuzzystrmatch/levenshtein.c @@ -377,7 +377,7 @@ levenshtein_internal(text *s, text *t, prev[start_column] = max_d + 1; curr[start_column] = max_d + 1; if (start_column != 0) - s_data += s_char_len != NULL ? s_char_len[i - 1] : 1; + s_data += (s_char_len != NULL) ? s_char_len[start_column - 1] : 1; start_column++; } -- 2.40.0