lkml.org 
[lkml]   [2022]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 12/20] vsprintf: add new `%pA` format specifier
On Mon, Feb 14, 2022 at 11:52 AM Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
>
> I think the point is for vsnprintf() to call (back) into Rust code.

Indeed, this is the case.

> That said, I don't like the !CONFIG_RUST version to return NULL, that
> will surely crash moments later.
>
> So I prefer something like
>
> [rust.h]
> // no CONFIG_RUST conditional
> +char *rust_fmt_argument(char* buf, char* end, void *ptr);
>
> [vsprintf.c]
> + case 'A':
> + if (IS_ENABLED(CONFIG_RUST))
> + return rust_fmt_argument(buf, end, ptr);
> + else
> + return string_nocheck(buf, end, "[%pA in non-Rust
> code?!]", default_str_spec);

Sounds good. Or perhaps simply `break` and let it print the pointer
(to be consistent with `g` case and non-error `e` case).

Cheers,
Miguel

\
 
 \ /
  Last update: 2022-02-14 13:13    [W:0.446 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site