From 663af3422a648e87945e4d8c0cc3e13671f2bbde Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 20 Sep 2007 00:42:15 +0200 Subject: Full rework of quote_c_style and write_name_quoted. * quote_c_style works on a strbuf instead of a wild buffer. * quote_c_style is now clever enough to not add double quotes if not needed. * write_name_quoted inherits those advantages, but also take a different set of arguments. Now instead of asking for quotes or not, you pass a "terminator". If it's \0 then we assume you don't want to escape, else C escaping is performed. In any case, the terminator is also appended to the stream. It also no longer takes the prefix/prefix_len arguments, as it's seldomly used, and makes some optimizations harder. * write_name_quotedpfx is created to work like write_name_quoted and take the prefix/prefix_len arguments. Thanks to those API changes, diff.c has somehow lost weight, thanks to the removal of functions that were wrappers around the old write_name_quoted trying to give it a semantics like the new one, but performing a lot of allocations for this goal. Now we always write directly to the stream, no intermediate allocation is performed. As a side effect of the refactor in builtin-apply.c, the length of the bar graphs in diffstats are not affected anymore by the fact that the path was clipped. Signed-off-by: Pierre Habouzit --- builtin-check-attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin-check-attr.c') diff --git a/builtin-check-attr.c b/builtin-check-attr.c index d94973379c..6afdfa10a1 100644 --- a/builtin-check-attr.c +++ b/builtin-check-attr.c @@ -56,7 +56,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix) else if (ATTR_UNSET(value)) value = "unspecified"; - write_name_quoted("", 0, argv[i], 1, stdout); + quote_c_style(argv[i], NULL, stdout, 0); printf(": %s: %s\n", argv[j+1], value); } } -- cgit v1.2.3