lkml.org 
[lkml]   [2022]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 03/28] vsprintf: %pf(%p)
On Thu, May 19, 2022 at 01:23:56PM -0400, Kent Overstreet wrote:
> + while (1) {
> + if (WARN_ON_ONCE(nr_args == ARRAY_SIZE(fn_args)))
> + goto out;
> + if (*fmt++ != '%')
> + goto out;
> + if (*fmt++ != 'p')
> + goto out;
> + fn_args[nr_args++] = va_arg(args, void *);
> + if (*fmt == ')')
> + break;
> + if (*fmt++ != ',')
> + goto out;
> + }
> +
> + call_pr_fn(out, fn, fn_args, nr_args);
> + fmt++; /* past trailing ) */

It's not a big thing, but why not make the loop do:

c = *fmt++;
if (c == ')')
break;
if (c != ',')
goto out;

and then you can drop the fmt++ line outside the loop.

(it's obviosuly awkward; it needed a comment)

\
 
 \ /
  Last update: 2022-05-19 23:22    [W:0.334 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site