From d452fcefe0220893ef1a8f868640809b4766480c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 26 Oct 2023 08:47:13 +0000 Subject: Modify string_quote/unquote to allow encoding of space as \s Signed-off-by: Laurent Bercot --- src/libstddjb/string_quote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstddjb/string_quote.c') diff --git a/src/libstddjb/string_quote.c b/src/libstddjb/string_quote.c index f995beb..c3a38f0 100644 --- a/src/libstddjb/string_quote.c +++ b/src/libstddjb/string_quote.c @@ -3,12 +3,12 @@ #include #include -int string_quote (stralloc *sa, char const *s, size_t len) +int string_quote_options (stralloc *sa, char const *s, size_t len, uint32_t options) { size_t base = sa->len ; int wasnull = !sa->s ; if (!stralloc_catb(sa, "\"", 1)) return 0 ; - if (!string_quote_nodelim(sa, s, len) || !stralloc_catb(sa, "\"", 1)) + if (!string_quote_nodelim_mustquote_options(sa, s, len, "\"", 1, options) || !stralloc_catb(sa, "\"", 1)) { if (wasnull) stralloc_free(sa) ; else sa->len = base ; return 0 ; -- cgit v1.3.1