[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D93S1SHPJDDU.INJ3UWZUM1UY@buenzli.dev>
Date: Fri, 11 Apr 2025 13:36:27 +0200
From: "Remo Senekowitsch" <remo@...nzli.dev>
To: "Petr Mladek" <pmladek@...e.com>
Cc: "Steven Rostedt" <rostedt@...dmis.org>, "Andy Shevchenko"
<andriy.shevchenko@...ux.intel.com>, "Rasmus Villemoes"
<linux@...musvillemoes.dk>, "Sergey Senozhatsky"
<senozhatsky@...omium.org>, <linux-kernel@...r.kernel.org>
Subject: Re: Exporting functions from vsprintf.c for Rust
On Fri Apr 11, 2025 at 11:42 AM CEST, Petr Mladek wrote:
>
> Honestly, I do not have a good feeling about exporting the internal
> vsprintf() functions. They have a very specific semantic.
>
> Especially, they return pointer to the next-to-write character.
> And it might be even beyond the given *end pointer. It is because, for
> example, vsnprintf() returns the number of characters which would
> have been written to the buffer when it was big enough.
>
> Instead, I suggest to create a wrapper which would have a sane
> semantic and call scnprintf() internally. Something like:
>
> int fwnode_full_name_to_string(char *buf, size_t size,
> struct fwnode_handle *fwnode)
> {
> return scnprintf(buf, size, "%pfwf", fwnode);
> }
That makes sense. I tried your suggestion and it works, thank you!
Best regards,
Remo
Powered by blists - more mailing lists