From: Tom Lane Date: Sun, 5 Jul 2026 20:22:40 +0000 (-0400) Subject: Simplify dxsyn_lexize(). X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f03dab4574bd2820eec6902c2ef12b28c706733;p=thirdparty%2Fpostgresql.git Simplify dxsyn_lexize(). There's no need to create and free a temporary copy of the input, since str_tolower() is already able to cope with not-certainly- nul-terminated input. (Before v18, copying was needed because this code used lowerstr(), but now we can do without.) Author: Ayush Tiwari Reviewed-by: Tom Lane Discussion: https://postgr.es/m/19525-b0be8e4eb7dbaf07@postgresql.org --- diff --git a/contrib/dict_xsyn/dict_xsyn.c b/contrib/dict_xsyn/dict_xsyn.c index 9e3784e0f47..b4fa3b2e524 100644 --- a/contrib/dict_xsyn/dict_xsyn.c +++ b/contrib/dict_xsyn/dict_xsyn.c @@ -212,13 +212,8 @@ dxsyn_lexize(PG_FUNCTION_ARGS) PG_RETURN_POINTER(NULL); /* Create search pattern */ - { - char *temp = pnstrdup(in, length); - - word.key = str_tolower(temp, length, DEFAULT_COLLATION_OID); - pfree(temp); - word.value = NULL; - } + word.key = str_tolower(in, length, DEFAULT_COLLATION_OID); + word.value = NULL; /* Look for matching syn */ found = (Syn *) bsearch(&word, d->syn, d->len, sizeof(Syn), compare_syn);