Page MenuHomeFreeBSD

whereis(1): Simplify code
ClosedPublic

Authored by fernape on Sat, Sep 19, 5:30 PM.
Tags
None
Referenced Files
F173622502: D59846.id187241.diff
Sun, Sep 27, 6:10 AM
F173615303: D59846.id.diff
Sun, Sep 27, 5:05 AM
F173607946: D59846.id.diff
Sun, Sep 27, 3:59 AM
F173514083: D59846.id187696.diff
Sat, Sep 26, 12:25 PM
Unknown Object (File)
Sat, Sep 26, 5:41 AM
Unknown Object (File)
Fri, Sep 25, 9:07 AM
Unknown Object (File)
Thu, Sep 24, 11:44 PM
Unknown Object (File)
Thu, Sep 24, 6:57 AM
Subscribers

Details

Summary

Simplify the way we build paths.
Avoid decolonification of source paths. It is prone to leave memory leaks depending on its result, overwriting the b variable all the time.

Fix a memory leak while here in the call to setenv.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks great so far :)!

usr.bin/whereis/pathnames.h
35

Please track /cddl in the source tree (it's been present for a while).

35–51

Could /usr/src please be swapped out and these be changed to "subdirectories" instead of hardcoding /usr/src for each entry?

38–42

These directories have been gone for a while.

fernape edited the summary of this revision. (Show Details)

Remove gnu directories and add non-tracked ones

usr.bin/whereis/pathnames.h
35–51

It can, but is it useful?
let's say we store /usr/src in src_base. Then we need to concatenate (asprintf) src_base with sourcepaths[i] to create sourcedirs. I don't know if the tradeoff is beneficial.

Or do you have a different idea?

ngie added inline comments.
usr.bin/whereis/pathnames.h
35–51

It can, but is it useful?
let's say we store /usr/src in src_base. Then we need to concatenate (asprintf) src_base with sourcepaths[i] to create sourcedirs. I don't know if the tradeoff is beneficial.

Or do you have a different idea?

It's useful just so whereis generates useful source tree information. It doesn't have to be done now since it's an existing issue though.

This revision is now accepted and ready to land.Sat, Sep 26, 12:01 PM
This revision was automatically updated to reflect the committed changes.