reshke commented on code in PR #1750:
URL: https://github.com/apache/cloudberry/pull/1750#discussion_r3264056798


##########
src/common/stringinfo.c:
##########
@@ -364,16 +364,32 @@ enlargeStringInfo(StringInfo str, int needed)
 void
 replaceStringInfoString(StringInfo str, char *replace, char *replacement)
 {
-       char    *ptr;
+       char    *match_ptr = NULL;
+       char    *start_ptr = str->data;
+       char    *dup = NULL;
+       size_t  replace_len = strlen(replace);
 
-       while ((ptr = strstr(str->data, replace)) != NULL)
-       {
-               char       *dup = pstrdup(str->data);
+       // prevent empty loop, cuz strstr will always return start_ptr

Review Comment:
   cuz -> because 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to