mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jonas Rebmann <jre@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: Re: [PATCH v3 1/4] scripts: include: Add string_util.h for strsep_unescaped
Date: Tue, 17 Mar 2026 12:16:48 +0100	[thread overview]
Message-ID: <581410c9-2617-431e-a771-dbef20ff2504@pengutronix.de> (raw)
In-Reply-To: <hj565xhm3wewvsaynr5atw2yfkz7huxjkqx4myewl3dhxwhgmm@ypfksvmwjite>

Hello,

On 2026-03-17 00:25, Marco Felsch wrote:
>> +// SPDX-SnippetBegin
>> +// SPDX-Snippet-Comment: Origin-URL: https://git.pengutronix.de/cgit/barebox/tree/lib/string.c?id=dfcf686f94a5a5387660f2afab79a714baab828a
> 
> Do we really need this if we reference code within our own repo?

Yes, we want any code copied in verbatim to be referenced so we can have
an eye on diverging implementations.

>> +/**
>> + * strsep_unescaped - Split a string into tokens, while ignoring escaped delimiters
>> + * @s: The string to be searched
>> + * @ct: The delimiter characters to search for
>> + * @delim: optional pointer to store found delimiter into
>> + *
>> + * strsep_unescaped() behaves like strsep unless it meets an escaped delimiter.
>> + * In that case, it shifts the string back in memory to overwrite the escape's
>> + * backslash then continues the search until an unescaped delimiter is found.
>> + *
>> + * On end of string, this function returns NULL. As long as a non-NULL
>> + * value is returned and @delim is not NULL, the found delimiter will
>> + * be stored into *@delim.
>> + */
>> +static char *strsep_unescaped(char **s, const char *ct, char *delim)
> 
> Is there a reason for defining this function within a .h instead of a .c
> file?

Yes, this is how it's done in scripts/include because those "scripts"
are single-source.

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



  reply	other threads:[~2026-03-17 11:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 16:00 [PATCH v3 0/4] Allow multiple keyspecs in one environment variable Jonas Rebmann
2026-03-16 16:00 ` [PATCH v3 1/4] scripts: include: Add string_util.h for strsep_unescaped Jonas Rebmann
2026-03-16 23:25   ` Marco Felsch
2026-03-17 11:16     ` Jonas Rebmann [this message]
2026-03-16 16:00 ` [PATCH v3 2/4] crypto: keytoc: Improve readability Jonas Rebmann
2026-03-16 16:00 ` [PATCH v3 3/4] crypto: keytoc: Split env-provided full keyspec on spaces Jonas Rebmann
2026-03-17  0:00   ` Marco Felsch
2026-03-17 11:11     ` Jonas Rebmann
2026-03-16 16:00 ` [PATCH v3 4/4] Documentation: migration-guides: Document change in keyspec env vars Jonas Rebmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=581410c9-2617-431e-a771-dbef20ff2504@pengutronix.de \
    --to=jre@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox