All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] kstrtox: make _parse_integer() flexible
@ 2026-06-02 20:29 Andy Shevchenko
  2026-06-02 20:29 ` [PATCH v1 1/2] kstrtox: Make _parse_integer() take variadic arguments Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andy Shevchenko @ 2026-06-02 20:29 UTC (permalink / raw)
  To: Dmitry Antipov, Andy Shevchenko, Petr Mladek, linux-kernel
  Cc: Andrew Morton, Steven Rostedt, Rasmus Villemoes,
	Sergey Senozhatsky, rodrigo.alencar, dlechner, jic23

Currently every new wrapper on _parse_integer_limit() will need a new name
to share with users while keeping some optional arguments to be initialised
explicitly. Since there is an attempt to expand this more, I decided to
suggest this mini series to avoid namespace pollution and unneeded churn in
the future.

To expand this API more, the possible future change may be:

 unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *res,
-                                  size_t max_chars);
+                                  size_t max_chars, $new_opt_arg);

 #define _parse_integer0(s, base, res, ...)                                              \
-        _parse_integer_limit(s, base, res, INT_MAX);
+        _parse_integer_limit(s, base, res, INT_MAX, $new_opt_arg=$default);

 #define _parse_integer1(s, base, res, max_chars, ...)                                   \
-        _parse_integer_limit(s, base, res, max_chars);
+        _parse_integer_limit(s, base, res, max_chars, $new_opt_arg=$default);

+#define _parse_integer2(s, base, res, max_chars, new_opt_arg, ...)                      \
+        _parse_integer_limit(s, base, res, max_chars, new_opt_arg);

So you got the idea. (It is roughly overloaded function in OOP.)

Andy Shevchenko (2):
  kstrtox: Make _parse_integer() take variadic arguments
  vsprintf: Convert to use _parse_integer() instead of
    _parse_integer_limit()

 lib/kstrtox.c  |  6 ------
 lib/kstrtox.h  | 12 +++++++++++-
 lib/vsprintf.c |  2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-06-04  7:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 20:29 [PATCH v1 0/2] kstrtox: make _parse_integer() flexible Andy Shevchenko
2026-06-02 20:29 ` [PATCH v1 1/2] kstrtox: Make _parse_integer() take variadic arguments Andy Shevchenko
2026-06-03  6:47   ` Andy Shevchenko
2026-06-03 10:37   ` David Laight
2026-06-03 10:54     ` Andy Shevchenko
2026-06-03 10:56       ` Andy Shevchenko
2026-06-03 11:34         ` David Laight
2026-06-02 20:29 ` [PATCH v1 2/2] vsprintf: Convert to use _parse_integer() instead of _parse_integer_limit() Andy Shevchenko
2026-06-03 11:23 ` [PATCH v1 0/2] kstrtox: make _parse_integer() flexible Petr Mladek
2026-06-03 11:51   ` Rodrigo Alencar
2026-06-03 12:10     ` Rodrigo Alencar
2026-06-03 13:58       ` Andy Shevchenko
2026-06-03 13:53     ` Andy Shevchenko
2026-06-04  6:59       ` Petr Mladek
2026-06-04  7:19         ` Andy Shevchenko
2026-06-04  7:48           ` Rodrigo Alencar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.