[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40914a69-d4b7-4fdd-bc58-cf9b28271ac3@rasmusvillemoes.dk>
Date: Thu, 7 Mar 2024 09:18:17 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bootconfig: do not put quotes on cmdline items unless
necessary
On 07/03/2024 09.10, Rasmus Villemoes wrote:
>>> +static int has_space(const char *v)
>>> +{
>>> + for (; *v; v++)
>>> + if (isspace(*v))
>>> + return 1;
>>> + return 0;
>>> +}
>>
>> Do we already have something which does this?
>
> Well, 'value[strcspn(value, " \t\r\n")] ? "\"" : ""' would be a
> oneliner, but not particularly readable. Also that list of characters
> doesn't necessarily match isspace(), see below.
I didn't look close enough. We do have strpbrk(), so strpbrk(value, "
\t\r\n") ? .. : .. , but that still leaves the question of just what set
of characters to search for. But there's no harm in just making it "
\t\n\v\f\r\xa0" except it requires a comment saying "these are precisely
the isspace() characters in the kernel's ctype".
Rasmus
Powered by blists - more mailing lists