Re: [PATCH 1/2] remove all uses of printf's %n

From: Joe Perches
Date: Mon Sep 16 2013 - 14:03:40 EST


On Mon, 2013-09-16 at 13:21 -0400, George Spelvin wrote:
> > My thought was to add a seq_last_len()
>
> In addition to adding per-call overhead to support a rarely-used feature
> (while ->pos comes for free), this has the downside that it matters how
> many separate calls are used to generate the string.
>
> The advantage of the "read ->pos before and after" technique is that
> you can have an arbitrary number of output calls in between.
> Including things like seq_path(), seq_bitmap(), etc.
>
> If you have the printing done in a subroutine (as in the net/ipv4
> directory), it would be annoyingly subtle if seq_puts("foobar")
> were not equivalent to seq_puts("foo"); seq_puts("bar").

It's already true that those aren't equivalent.
seq_puts(seq, "short ");
set_puts(seq, "string");
may fit the first bit into the output buffer but not the last
where
setq_puts(seq, "short string");
would not fit at all.

btw: who are you? Is your name really George Spelvin?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/