From b538215d5d1c5c0675725fe539da26299682136a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 10 Jul 2006 18:40:16 +0000 Subject: [PATCH] Remove a few baby-C macros in fuzzystrmatch. Add a few missing includes. --- contrib/btree_gist/btree_utils_num.h | 1 + contrib/btree_gist/btree_utils_var.h | 2 ++ contrib/dblink/dblink.h | 4 +++- contrib/fuzzystrmatch/fuzzystrmatch.c | 8 ++++---- contrib/fuzzystrmatch/fuzzystrmatch.h | 5 +---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/btree_gist/btree_utils_num.h b/contrib/btree_gist/btree_utils_num.h index 322c5759e4..0f59342d96 100644 --- a/contrib/btree_gist/btree_utils_num.h +++ b/contrib/btree_gist/btree_utils_num.h @@ -1,3 +1,4 @@ +#include "btree_gist.h" typedef char GBT_NUMKEY; diff --git a/contrib/btree_gist/btree_utils_var.h b/contrib/btree_gist/btree_utils_var.h index 9b7be0de0d..cddfadfab1 100644 --- a/contrib/btree_gist/btree_utils_var.h +++ b/contrib/btree_gist/btree_utils_var.h @@ -1,5 +1,7 @@ #include "mb/pg_wchar.h" +#include "btree_gist.h" + /* Variable length key */ typedef bytea GBT_VARKEY; diff --git a/contrib/dblink/dblink.h b/contrib/dblink/dblink.h index b0ab4f0245..969843765f 100644 --- a/contrib/dblink/dblink.h +++ b/contrib/dblink/dblink.h @@ -8,7 +8,7 @@ * Darko Prenosil * Shridhar Daithankar * - * $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.15 2006/03/11 04:38:29 momjian Exp $ + * $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.16 2006/07/10 18:40:16 momjian Exp $ * Copyright (c) 2001-2006, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -34,6 +34,8 @@ #ifndef DBLINK_H #define DBLINK_H +#include "fmgr.h" + /* * External declarations */ diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index 9b12c8f1fd..7102fee858 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -5,7 +5,7 @@ * * Joe Conway * - * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.21 2006/05/30 22:12:13 tgl Exp $ + * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.22 2006/07/10 18:40:16 momjian Exp $ * Copyright (c) 2001-2006, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -142,7 +142,7 @@ levenshtein(PG_FUNCTION_ARGS) * position in the source string, matches the character at the * current row position in the target string; cost is 1 otherwise. */ - c = ((CHAREQ(str_s, str_t)) ? 0 : 1); + c = (*str_s != *str_t); /* * c1 is upper right cell plus 1 @@ -167,7 +167,7 @@ levenshtein(PG_FUNCTION_ARGS) /* * Increment the pointer to str_s */ - NextChar(str_s); + str_s++; } /* @@ -181,7 +181,7 @@ levenshtein(PG_FUNCTION_ARGS) /* * Increment the pointer to str_t */ - NextChar(str_t); + str_t++; /* * Rewind the pointer to str_s diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.h b/contrib/fuzzystrmatch/fuzzystrmatch.h index 42f7f1fa30..a8038d23f3 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.h +++ b/contrib/fuzzystrmatch/fuzzystrmatch.h @@ -5,7 +5,7 @@ * * Joe Conway * - * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.h,v 1.13 2006/03/11 04:38:29 momjian Exp $ + * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.h,v 1.14 2006/07/10 18:40:16 momjian Exp $ * Copyright (c) 2001-2006, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -81,9 +81,6 @@ static const char *soundex_table = "01230120022455012623010202"; /* * Levenshtein */ -#define STRLEN(p) strlen(p) -#define CHAREQ(p1, p2) (*(p1) == *(p2)) -#define NextChar(p) ((p)++) #define MAX_LEVENSHTEIN_STRLEN 255 -- 2.40.0