Thread (1 message) 1 message, 1 author, 2020-05-06

Re: [PATCH v4] submodule: port subcommand 'set-url' from shell to C

From: Junio C Hamano <hidden>
Date: 2020-05-06 17:17:07

Shourya Shukla [off-list ref] writes:
On 06/05 10:09, Christian Couder wrote:
quoted
quoted
+       strbuf_addf(&config_name, "submodule.%s.url", path);
+
+       config_set_in_gitmodules_file_gently(config_name.buf, newurl);
+       sync_submodule(path, prefix, quiet ? OPT_QUIET : 0);
+
+       strbuf_release(&config_name);
Nit: it might be a bit simpler to define config_name as a "char *",
and then use xstrfmt() and free() instead of strbuf_addf() and
strbuf_release().
Apart from the simplicity purposes, does doing this aid in performance
in any way?
strbuf.c::xstrfmt() uses strbuf.c::xstrvfmt() that formats into a
temporary strbuf and returns the detached buffer as the result.

Compare it with what strbuf.c::strbuf_addf() and you can draw a
conclusion on your own ;-)

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