Page MenuHomeFreeBSD

config: drop dependency on libsbuf
ClosedPublic

Authored by kevans on Jan 30 2023, 3:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 10:23 PM
Unknown Object (File)
Fri, Nov 22, 10:23 PM
Unknown Object (File)
Fri, Nov 22, 10:23 PM
Unknown Object (File)
Fri, Nov 22, 10:23 PM
Unknown Object (File)
Fri, Nov 22, 10:23 PM
Unknown Object (File)
Fri, Nov 22, 10:11 PM
Unknown Object (File)
Fri, Nov 15, 7:24 AM
Unknown Object (File)
Fri, Nov 15, 5:53 AM
Subscribers

Details

Summary

Use an std::stringstream instead. get_word() and get_quoted_word() both
return a buffer that's presumed to not need release, so solve this by
returning a new special configword type that holds a string or eof/eol
state. This cleans up caller checking for EOF/EOL to make it more
explicit what they're doing, at least in the EOL cases which previously
checked for NULL.

Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 49324
Build 46214: arc lint + arc unit

Event Timeline

kevans created this revision.

Same C++ caveat
this looks like a fairly mechanical translation. I didn't see anything worth remarking on, except the depend stuff.
I'd try to have more eyes on it though... it's long enough a mistake might slip through (though the odds of that are somewhat reduced by a make universe and test booting)

tools/build/depend-cleanup.sh
121

Hmmm, you should have corrected the prior version instead of changing it here.

This revision is now accepted and ready to land.Jan 30 2023, 4:50 PM
usr.sbin/config/config.h
44

Is this because mkheaders.c isn't converted? In which case what's stopping it?

78

If you had operator* then one could use &* to do the same, a common pattern used in LLVM to unwrap things

usr.sbin/config/main.cc
52

I have no clue what style(9) says about C++ but this seems like an odd order? It's alphabetical other than dirent.h at the moment.

usr.sbin/config/config.h
44

mkheaders.c but also lang.l and config.y

78

Looking at it again, the cast is to more cleanly support implicit conversions in strdup()/strcmp()/etc, but how about this new version? (Adding an operator-> that allows configword->c_str() instead of explicit casts in a couple of output places)

78

That is: "mostly desirable to more cleanly ..."

Add an operator->, use it for some explicit c string conversions

This revision now requires review to proceed.Feb 6 2023, 4:31 AM
usr.sbin/config/config.h
78

Yeah that's nicer, though if you have -> you should also make * consistent (const std::string &operator*() const)

Provide a logically consistent operator*

This revision was not accepted when it landed; it landed in state Needs Review.Feb 9 2023, 5:27 AM
This revision was automatically updated to reflect the committed changes.