Thread (1 message) 1 message, 1 author, 2025-02-03

Re: [PATCH v3 1/4] quote: add c quote flag to ignore core.quotePath

From: Junio C Hamano <hidden>
Date: 2025-02-03 22:14:52

Christian Couder [off-list ref] writes:
On Sat, Feb 1, 2025 at 9:20 PM Justin Tobler [off-list ref] wrote:

quoted
-static inline int cq_must_quote(char c)
+static inline int cq_must_quote(char c, int ignore_config)
I think it's a bit better to use 'unsigned int' instead of just 'int'
for such flags, but it's fine here to use an 'int' because both
`quote_path_fully` and `no_dq` below already use that type.
Yup, good forward thinking to suggest using unsigned as these "this
is just a single bit, so let's use platform natural int" tend to
grow into "there is this another bit that is orthogonal, so pass it
as well in the same flag word", at which point unsigned would work
better for us.  But until that happens, plain platform natural int
is fine.
quoted
-               for (len = 0; len < maxlen && !cq_must_quote(s[len]); len++);
+               for (len = 0;
+                    len < maxlen && !cq_must_quote(s[len], ignore_config); len++);
Micronit: If you really want to split the line into many lines, I
think it might be better to go all the way like this:

              for (len = 0;
                   len < maxlen && !cq_must_quote(s[len], ignore_config);
                   len++);
Good style suggestion.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help