summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ltree/lquery_op.c2
-rw-r--r--contrib/ltree/ltxtquery_op.c2
-rw-r--r--contrib/pgcrypto/internal.c4
-rw-r--r--contrib/pgcrypto/md5.c4
-rw-r--r--contrib/pgcrypto/mhash.c8
-rw-r--r--contrib/pgcrypto/pgcrypto.c33
-rw-r--r--contrib/pgcrypto/px-crypt.c4
-rw-r--r--contrib/pgcrypto/px.c4
-rw-r--r--contrib/pgcrypto/sha1.c10
-rw-r--r--contrib/spi/timetravel.c2
-rw-r--r--contrib/tsearch2/dict_ispell.c6
-rw-r--r--contrib/tsearch2/ispell/spell.c8
-rw-r--r--contrib/tsearch2/wparser_def.c10
13 files changed, 44 insertions, 53 deletions
diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c
index 2328fcd2386..81a1b788aa2 100644
--- a/contrib/ltree/lquery_op.c
+++ b/contrib/ltree/lquery_op.c
@@ -91,7 +91,7 @@ checkLevel(lquery_level * curq, ltree_level * curt)
for (i = 0; i < curq->numvar; i++)
{
- cmpptr = (curvar->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+ cmpptr = (curvar->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
if (curvar->flag & LVAR_SUBLEXEM)
{
diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c
index 263f39b5e4d..1bba66954b5 100644
--- a/contrib/ltree/ltxtquery_op.c
+++ b/contrib/ltree/ltxtquery_op.c
@@ -54,7 +54,7 @@ checkcondition_str(void *checkval, ITEM * val)
char *op = ((CHKVAL *) checkval)->operand + val->distance;
int (*cmpptr) (const char *, const char *, size_t);
- cmpptr = (val->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+ cmpptr = (val->flag & LVAR_INCASE) ? pg_strncasecmp : strncmp;
while (tlen > 0)
{
if (val->flag & LVAR_SUBLEXEM)
diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c
index 4dca6dba541..db7b46da067 100644
--- a/contrib/pgcrypto/internal.c
+++ b/contrib/pgcrypto/internal.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.12 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.13 2004/05/07 00:24:57 tgl Exp $
*/
@@ -561,7 +561,7 @@ px_find_digest(const char *name, PX_MD ** res)
PX_MD *h;
for (p = int_digest_list; p->name; p++)
- if (!strcasecmp(p->name, name))
+ if (pg_strcasecmp(p->name, name) == 0)
{
h = px_alloc(sizeof(*h));
p->init(h);
diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c
index 35bbe787118..4a236178760 100644
--- a/contrib/pgcrypto/md5.c
+++ b/contrib/pgcrypto/md5.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.10 2003/11/29 22:39:28 pgsql Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.11 2004/05/07 00:24:57 tgl Exp $ */
/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
/*
@@ -141,7 +141,7 @@ md5_init(md5_ctxt * ctxt)
ctxt->md5_stb = MD5_B0;
ctxt->md5_stc = MD5_C0;
ctxt->md5_std = MD5_D0;
- bzero(ctxt->md5_buf, sizeof(ctxt->md5_buf));
+ memset(ctxt->md5_buf, 0, sizeof(ctxt->md5_buf));
}
void
diff --git a/contrib/pgcrypto/mhash.c b/contrib/pgcrypto/mhash.c
index 1ecfca6bed1..934a83271df 100644
--- a/contrib/pgcrypto/mhash.c
+++ b/contrib/pgcrypto/mhash.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/mhash.c,v 1.9 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/mhash.c,v 1.10 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
@@ -217,9 +217,9 @@ find_hashid(const char *name)
mname = mhash_get_hash_name(i);
if (mname == NULL)
continue;
- b = strcasecmp(name, mname);
+ b = pg_strcasecmp(name, mname);
free(mname);
- if (!b)
+ if (b == 0)
{
res = i;
break;
@@ -312,7 +312,7 @@ px_find_cipher(const char *name, PX_Cipher ** res)
PX_Cipher *c;
- strcpy(nbuf, name);
+ StrNCpy(nbuf, name, sizeof(nbuf));
if ((p = strrchr(nbuf, '-')) != NULL)
{
diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c
index 6efc044b007..f28f960ad05 100644
--- a/contrib/pgcrypto/pgcrypto.c
+++ b/contrib/pgcrypto/pgcrypto.c
@@ -26,13 +26,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.15 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.16 2004/05/07 00:24:57 tgl Exp $
*/
-#include <postgres.h>
-#include <fmgr.h>
+#include "postgres.h"
+
#include <ctype.h>
+#include "fmgr.h"
+#include "parser/scansup.h"
+
#include "px.h"
#include "px-crypt.h"
#include "pgcrypto.h"
@@ -554,26 +557,12 @@ find_provider(text *name,
char *desc, int silent)
{
void *res;
- char buf[PX_MAX_NAMELEN + 1],
- *p;
- unsigned len;
- unsigned i;
+ char *buf;
int err;
- len = VARSIZE(name) - VARHDRSZ;
- if (len > PX_MAX_NAMELEN)
- {
- if (silent)
- return NULL;
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("%s type does not exist (name too long)", desc)));
- }
-
- p = VARDATA(name);
- for (i = 0; i < len; i++)
- buf[i] = tolower((unsigned char) p[i]);
- buf[len] = 0;
+ buf = downcase_truncate_identifier(VARDATA(name),
+ VARSIZE(name) - VARHDRSZ,
+ false);
err = provider_lookup(buf, &res);
@@ -582,5 +571,7 @@ find_provider(text *name,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s type does not exist: \"%s\"", desc, buf)));
+ pfree(buf);
+
return err ? NULL : res;
}
diff --git a/contrib/pgcrypto/px-crypt.c b/contrib/pgcrypto/px-crypt.c
index 84a3e78f9d3..463d1ddf731 100644
--- a/contrib/pgcrypto/px-crypt.c
+++ b/contrib/pgcrypto/px-crypt.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.7 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.8 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
@@ -170,7 +170,7 @@ px_gen_salt(const char *salt_type, char *buf, int rounds)
for (i = 0; gen_list[i].name; i++)
{
g = &gen_list[i];
- if (strcasecmp(g->name, salt_type) != 0)
+ if (pg_strcasecmp(g->name, salt_type) != 0)
continue;
if (g->def_rounds)
diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c
index 1f5aa434b4d..49c4bdc7317 100644
--- a/contrib/pgcrypto/px.c
+++ b/contrib/pgcrypto/px.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.8 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.9 2004/05/07 00:24:57 tgl Exp $
*/
#include <postgres.h>
@@ -39,7 +39,7 @@ px_resolve_alias(const PX_Alias * list, const char *name)
{
while (list->name)
{
- if (!strcasecmp(list->alias, name))
+ if (pg_strcasecmp(list->alias, name) == 0)
return list->name;
list++;
}
diff --git a/contrib/pgcrypto/sha1.c b/contrib/pgcrypto/sha1.c
index 21df9d6ff8b..0fc78bba437 100644
--- a/contrib/pgcrypto/sha1.c
+++ b/contrib/pgcrypto/sha1.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/pgcrypto/sha1.c,v 1.12 2003/11/29 22:39:28 pgsql Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/sha1.c,v 1.13 2004/05/07 00:24:57 tgl Exp $ */
/* $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $ */
/*
@@ -227,7 +227,7 @@ sha1_step(struct sha1_ctxt * ctxt)
H(3) = H(3) + d;
H(4) = H(4) + e;
- bzero(&ctxt->m.b8[0], 64);
+ memset(&ctxt->m.b8[0], 0, 64);
}
/*------------------------------------------------------------*/
@@ -235,7 +235,7 @@ sha1_step(struct sha1_ctxt * ctxt)
void
sha1_init(struct sha1_ctxt * ctxt)
{
- bzero(ctxt, sizeof(struct sha1_ctxt));
+ memset(ctxt, 0, sizeof(struct sha1_ctxt));
H(0) = 0x67452301;
H(1) = 0xefcdab89;
H(2) = 0x98badcfe;
@@ -255,14 +255,14 @@ sha1_pad(struct sha1_ctxt * ctxt)
padlen = 64 - padstart;
if (padlen < 8)
{
- bzero(&ctxt->m.b8[padstart], padlen);
+ memset(&ctxt->m.b8[padstart], 0, padlen);
COUNT += padlen;
COUNT %= 64;
sha1_step(ctxt);
padstart = COUNT % 64; /* should be 0 */
padlen = 64 - padstart; /* should be 64 */
}
- bzero(&ctxt->m.b8[padstart], padlen - 8);
+ memset(&ctxt->m.b8[padstart], 0, padlen - 8);
COUNT += (padlen - 8);
COUNT %= 64;
#if BYTE_ORDER == BIG_ENDIAN
diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c
index 29de8c6fda4..02570a403d7 100644
--- a/contrib/spi/timetravel.c
+++ b/contrib/spi/timetravel.c
@@ -498,7 +498,7 @@ findTTStatus(char *name)
TTOffList *pp;
for (pp = TTOff.next; pp; pp = pp->next)
- if (strcasecmp(name, pp->name) == 0)
+ if (pg_strcasecmp(name, pp->name) == 0)
return 0;
return 1;
}
diff --git a/contrib/tsearch2/dict_ispell.c b/contrib/tsearch2/dict_ispell.c
index a0e67a69e1d..5725c8fb362 100644
--- a/contrib/tsearch2/dict_ispell.c
+++ b/contrib/tsearch2/dict_ispell.c
@@ -62,7 +62,7 @@ spell_init(PG_FUNCTION_ARGS)
pcfg = cfg;
while (pcfg->key)
{
- if (strcasecmp("DictFile", pcfg->key) == 0)
+ if (pg_strcasecmp("DictFile", pcfg->key) == 0)
{
if (dictloaded)
{
@@ -81,7 +81,7 @@ spell_init(PG_FUNCTION_ARGS)
}
dictloaded = true;
}
- else if (strcasecmp("AffFile", pcfg->key) == 0)
+ else if (pg_strcasecmp("AffFile", pcfg->key) == 0)
{
if (affloaded)
{
@@ -100,7 +100,7 @@ spell_init(PG_FUNCTION_ARGS)
}
affloaded = true;
}
- else if (strcasecmp("StopFile", pcfg->key) == 0)
+ else if (pg_strcasecmp("StopFile", pcfg->key) == 0)
{
text *tmp = char2text(pcfg->value);
diff --git a/contrib/tsearch2/ispell/spell.c b/contrib/tsearch2/ispell/spell.c
index 838d9957028..10b0ca9e40a 100644
--- a/contrib/tsearch2/ispell/spell.c
+++ b/contrib/tsearch2/ispell/spell.c
@@ -10,7 +10,7 @@
#define MAX_NORM 1024
#define MAXNORMLEN 256
-#define STRNCASECMP(x,y) (strncasecmp(x,y,strlen(y)))
+#define STRNCASECMP(x,y) pg_strncasecmp(x, y, strlen(y))
#define GETWCHAR(W,L,N,T) ( ((uint8*)(W))[ ((T)=='p') ? (N) : ( (L) - 1 - (N) ) ] )
#define GETCHAR(A,N,T) GETWCHAR( (A)->repl, (A)->replen, N, T )
@@ -304,19 +304,19 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
continue;
}
}
- if (!STRNCASECMP(str, "suffixes"))
+ if (STRNCASECMP(str, "suffixes")==0)
{
suffixes = 1;
prefixes = 0;
continue;
}
- if (!STRNCASECMP(str, "prefixes"))
+ if (STRNCASECMP(str, "prefixes")==0)
{
suffixes = 0;
prefixes = 1;
continue;
}
- if (!STRNCASECMP(str, "flag "))
+ if (STRNCASECMP(str, "flag ")==0)
{
s = str + 5;
flagflags=0;
diff --git a/contrib/tsearch2/wparser_def.c b/contrib/tsearch2/wparser_def.c
index 99b47196e9b..a3d61126282 100644
--- a/contrib/tsearch2/wparser_def.c
+++ b/contrib/tsearch2/wparser_def.c
@@ -210,15 +210,15 @@ prsd_headline(PG_FUNCTION_ARGS)
while (mptr && mptr->key)
{
- if (strcasecmp(mptr->key, "MaxWords") == 0)
+ if (pg_strcasecmp(mptr->key, "MaxWords") == 0)
max_words = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "MinWords") == 0)
+ else if (pg_strcasecmp(mptr->key, "MinWords") == 0)
min_words = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "ShortWord") == 0)
+ else if (pg_strcasecmp(mptr->key, "ShortWord") == 0)
shortword = pg_atoi(mptr->value, 4, 1);
- else if (strcasecmp(mptr->key, "StartSel") == 0)
+ else if (pg_strcasecmp(mptr->key, "StartSel") == 0)
prs->startsel = pstrdup(mptr->value);
- else if (strcasecmp(mptr->key, "StopSel") == 0)
+ else if (pg_strcasecmp(mptr->key, "StopSel") == 0)
prs->stopsel = pstrdup(mptr->value);
pfree(mptr->key);