Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6de3fe3

Browse files
committed
Avoid conflict strndup with glibc
1 parent 461b71f commit 6de3fe3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/tsearch2/ispell/spell.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ strlower(char *str)
4141
}
4242

4343
static char*
44-
strndup(char *s, int len) {
44+
strnduplicate(char *s, int len) {
4545
char *d=(char*)palloc( len + 1 );
4646
memcpy(d, s, len );
4747
d[len]='\0';
@@ -866,7 +866,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
866866
/* and its length more than minimal */
867867
if ( wordlen==level+1 ) {
868868
/* well, it was last word */
869-
var->stem[ var->nstem ] = strndup(word + startpos, wordlen - startpos);
869+
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
870870
var->nstem++;
871871
return var;
872872
} else {
@@ -877,7 +877,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
877877
ptr->next=SplitToVariants(Conf, node, var, word, wordlen, startpos, level);
878878
/* we can find next word */
879879
level++;
880-
var->stem[ var->nstem ] = strndup(word + startpos, level - startpos);
880+
var->stem[ var->nstem ] = strnduplicate(word + startpos, level - startpos);
881881
var->nstem++;
882882
node = Conf->Dictionary;
883883
startpos=level;
@@ -889,7 +889,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
889889
node=StopMiddle->node;
890890
}
891891

892-
var->stem[ var->nstem ] = strndup(word + startpos, wordlen - startpos);
892+
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
893893
var->nstem++;
894894
return var;
895895
}

0 commit comments

Comments
 (0)