summaryrefslogtreecommitdiff
path: root/contrib/tsearch2/tsvector.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-10-05 17:57:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-10-05 17:57:40 +0000
commite378f82e0029a7a6fda9c655bd79d4404e566c0b (patch)
tree744c1cd2841844ddf00880e80aae9ab7b460edfd /contrib/tsearch2/tsvector.c
parentf2332ea1e99e2a2d04d1744c86e899c52f5e841e (diff)
downloadpostgresql-e378f82e0029a7a6fda9c655bd79d4404e566c0b.tar.gz
Make use of qsort_arg in several places that were formerly using klugy
static variables. This avoids any risk of potential non-reentrancy, and in particular offers a much cleaner workaround for the Intel compiler bug that was affecting ginutil.c.
Diffstat (limited to 'contrib/tsearch2/tsvector.c')
-rw-r--r--contrib/tsearch2/tsvector.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/tsearch2/tsvector.c b/contrib/tsearch2/tsvector.c
index a4a9d57d64..1abf1914e3 100644
--- a/contrib/tsearch2/tsvector.c
+++ b/contrib/tsearch2/tsvector.c
@@ -85,14 +85,14 @@ uniquePos(WordEntryPos * a, int4 l)
return res + 1 - a;
}
-static char *BufferStr;
static int
-compareentry(const void *a, const void *b)
+compareentry(const void *a, const void *b, void *arg)
{
+ char *BufferStr = (char *) arg;
+
if (((WordEntryIN *) a)->entry.len == ((WordEntryIN *) b)->entry.len)
{
- return strncmp(
- &BufferStr[((WordEntryIN *) a)->entry.pos],
+ return strncmp(&BufferStr[((WordEntryIN *) a)->entry.pos],
&BufferStr[((WordEntryIN *) b)->entry.pos],
((WordEntryIN *) a)->entry.len);
}
@@ -117,8 +117,7 @@ uniqueentry(WordEntryIN * a, int4 l, char *buf, int4 *outbuflen)
}
ptr = a + 1;
- BufferStr = buf;
- qsort((void *) a, l, sizeof(WordEntryIN), compareentry);
+ qsort_arg((void *) a, l, sizeof(WordEntryIN), compareentry, (void *) buf);
while (ptr - a < l)
{