]> granicus.if.org Git - strace/commit
Rework string_quote API
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Jan 2015 01:17:08 +0000 (01:17 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Jan 2015 15:58:18 +0000 (15:58 +0000)
commit513e96eb94841734274c0607aae2c9f212411eee
tree260d8aff8b1b09122011cce9d7b8de310a54e699
parenta10b6feb4473de708625ff278d003c7e5f9dcd67
Rework string_quote API

string_quote() has proven to be too hard to use, replace it with
print_quoted_string() that does memory allocation and prints the result.

* defs.h (string_quote): Remove.
(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
(print_quoted_string): New prototype.
* util.c (string_quote): Make static; take "style" flags instead
of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
(ALLOCA_CUTOFF, use_alloca): New macros.
(print_quoted_string): New function.
(printpathn, printstr): Update to new API.
* loop.c (loop_ioctl): Likewise.
* mtd.c (ubi_ioctl): Likewise.
* net.c (print_scm_security): Likewise.
* socketutils.c (unix_parse_response): Likewise.
defs.h
loop.c
mtd.c
net.c
socketutils.c
util.c