summaryrefslogtreecommitdiff
path: root/src/libstddjb/string_quote.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-26 08:47:13 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-26 08:47:13 +0000
commitd452fcefe0220893ef1a8f868640809b4766480c (patch)
treeba39b0180313314a988dc44ee66de61d49f24f95 /src/libstddjb/string_quote.c
parentb305bf616804db7176601bc2acd3495f0217e1c4 (diff)
downloadskalibs-d452fcefe0220893ef1a8f868640809b4766480c.tar.xz
Modify string_quote/unquote to allow encoding of space as \s
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/string_quote.c')
-rw-r--r--src/libstddjb/string_quote.c4
1 files changed, 2 insertions, 2 deletions
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 <skalibs/stralloc.h>
#include <skalibs/skamisc.h>
-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 ;