"Garima Singh via GitGitGadget" [off-list ref] writes:
+ /*
+ * In case of null or empty tokens, add a '' to ensure we
+ * don't inadvertently drop those tokens
+ */
A good comment.
+ if (!src || !*src) {
I think a caller that passes src==NULL deserves a BUG, or just a
normal segfault. The condition here should just be "if (!*src)"
instead.
+ strbuf_addstr(dst, "''");
+ return;
+ }
Otherwise, the fix itself is good.
Thanks.
for (p = src; *p; p++) {
if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {
sq_quote_buf(dst, src);