Hi Mark,
Another example, can you take a look?

--- \dll\postgresql-12.0\a\backend\tsearch\spell.c      Mon Sep 30 17:06:55 2019
+++ spell.c     Sat Nov 09 05:55:23 2019
@@ -186,7 +186,7 @@
 #define MAX_NORM 1024
 #define MAXNORMLEN 256
 
-#define STRNCMP(s,p)   strncmp( (s), (p), strlen(p) )
+#define STRNCMP(s,p)   strncmp( (s), (p), sizeof(p) - 1 )
 #define GETWCHAR(W,L,N,T) ( ((const uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( 
(L) - 1 - (N) ) ] )
 #define GETCHAR(A,N,T)   GETWCHAR( (A)->repl, (A)->replen, N, T )
 
@@ -1220,31 +1220,31 @@
                }
 
                if (STRNCMP(recoded, "COMPOUNDFLAG") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("COMPOUNDFLAG"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("COMPOUNDFLAG") - 1,
                                                                          
FF_COMPOUNDFLAG);
                else if (STRNCMP(recoded, "COMPOUNDBEGIN") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("COMPOUNDBEGIN"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("COMPOUNDBEGIN") - 1,
                                                                          
FF_COMPOUNDBEGIN);
                else if (STRNCMP(recoded, "COMPOUNDLAST") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("COMPOUNDLAST"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("COMPOUNDLAST") - 1,
                                                                          
FF_COMPOUNDLAST);
                /* COMPOUNDLAST and COMPOUNDEND are synonyms */
                else if (STRNCMP(recoded, "COMPOUNDEND") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("COMPOUNDEND"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("COMPOUNDEND") - 1,
                                                                          
FF_COMPOUNDLAST);
                else if (STRNCMP(recoded, "COMPOUNDMIDDLE") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("COMPOUNDMIDDLE"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("COMPOUNDMIDDLE") - 1,
                                                                          
FF_COMPOUNDMIDDLE);
                else if (STRNCMP(recoded, "ONLYINCOMPOUND") == 0)
-                       addCompoundAffixFlagValue(Conf, recoded + 
strlen("ONLYINCOMPOUND"),
+                       addCompoundAffixFlagValue(Conf, recoded + 
sizeof("ONLYINCOMPOUND") - 1,
                                                                          
FF_COMPOUNDONLY);
                else if (STRNCMP(recoded, "COMPOUNDPERMITFLAG") == 0)
                        addCompoundAffixFlagValue(Conf,
-                                                                         
recoded + strlen("COMPOUNDPERMITFLAG"),
+                                                                         
recoded + sizeof("COMPOUNDPERMITFLAG") - 1,
                                                                          
FF_COMPOUNDPERMITFLAG);
                else if (STRNCMP(recoded, "COMPOUNDFORBIDFLAG") == 0)
                        addCompoundAffixFlagValue(Conf,
-                                                                         
recoded + strlen("COMPOUNDFORBIDFLAG"),
+                                                                         
recoded + sizeof("COMPOUNDFORBIDFLAG") - 1,
                                                                          
FF_COMPOUNDFORBIDFLAG);
                else if (STRNCMP(recoded, "FLAG") == 0)
                {

Attachment: spell.c.patch
Description: spell.c.patch



Reply via email to