Thread (22 messages) flat view 22 messages, 3 authors, 2022-01-18

Re: [PATCH 1/9] test-mergesort: use strbuf_getline()

From: René Scharfe <hidden>
Date: 2021-10-02 16:57:05

Am 02.10.21 um 11:08 schrieb Ævar Arnfjörð Bjarmason:
On Fri, Oct 01 2021, René Scharfe wrote:
quoted
 	while (lines) {
-		printf("%s", lines->text);
+		puts(lines->text);
 		lines = lines->next;
Aside: I wonder if we should have a coccicheck for that (not as part of
this series), but maybe it would generate too much noise.
To replace printf("%s\n", s) with puts(s)?  I considered such a semantic
patch before as well.  It would effectively forbid that specific printf
usage.  And why shouldn't it?  puts(3) is easier to use and its call is
shorter.

But puts(3) is also confusing: It adds a trailing newline, but its
sibling fputs(3) doesn't.  And it would look weird in the middle of a
run of printf calls.

Clang already does the replacement with -O1 and GCC even with -O0, so
there is no further performance improvement or object text size
reduction to be gained.

And so I dropped the idea.

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