[systemd-devel] [PATCH 1/9] util: Add unescape_first_word()

Richard Maw richard.maw at codethink.co.uk
Fri Jun 19 02:56:08 PDT 2015


On Thu, Jun 18, 2015 at 08:30:22PM +0200, Lennart Poettering wrote:
> On Thu, 28.05.15 13:02, Richard Maw (richard.maw at codethink.co.uk) wrote:
> 
> > This is a superset of the functionality of unquote_first_word, allowing
> > non-whitespace separators, and doesn't interpret quotes unless
> > UNQUOTE_QUOTES is included in flags.
> 
> Hmm, makes sense, but I'd actually just have one function
> extract_first_word() then, which replaces unquote_first_word() but has
> the signature of your unescape_first_word(). It would take the
> separators parameter, which would default to WHITESPACE if passed as
> NULL. THe flags should all be renamed EXTRACT_xyz instead of
> UNQUOTE_xyz then, and EXTRACT_UNQUOTE should be a prominent flag.

Thanks, I was sweating the nomeclature and wasn't happy with what I came up
with, but couldn't think of anything better.

> Then, all our current users of unquote_first_word() should be changed
> to use this new call.
> 
> Does that make sense?

Sure, I was just a little wary of making such wide changes across the codebase.

I also saw a couple of TODOs to convert uses of FOREACH_WORD family to the
unquote_many_words family. I'll see if I can feasibly convert those while I'm
changing string handling elsewhere.


More information about the systemd-devel mailing list