Messages in this thread | | | From | Miguel Ojeda <> | Date | Mon, 14 Feb 2022 13:12:24 +0100 | Subject | Re: [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
| |