| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| git_buf buf; | ||
| }; | ||
|
|
||
| static struct git_sysdir__dir git_sysdir__dirs[GIT_SYSDIR__MAX]; |
There was a problem hiding this comment.
Hum. If you're already creating a new sysdir struct, what do you think about including the guess callbacks into the struct and then drop the git_sysdir__dir_guess array? So basically
static struct git_sysdir__dir dirs[] = {
{ git_sysdir_guess_system_dirs, GIT_BUF_INIT },
{ git_sysdir_guess_global_dirs, GIT_BUF_INIT },
...
};
This would make the correlation of these two structures clearer and reduce a bit of its magic.
Sorry, something went wrong.
Don't try to determine when sysdirs are uninitialized. Instead, simply initialize them all at `git_libgit2_init` time and never try to reinitialize, except when consumers explicitly call `git_sysdir_set`. Looking at the buffer length is especially problematic, since there may no appropriate path for that value. (For example, the Windows-specific programdata directory has no value on non-Windows machines.) Previously we would continually trying to re-lookup these values, which could get racy if two different threads are each calling `git_sysdir_get` and trying to lookup / clear the value simultaneously.
| Back | FazBrowse Home | New Git URL |
Don't assume that an empty system directory buffer is uninitialized.
In fact, there simply may be no appropriate path for that value.
(For example, the Windows-specific programdata directory has no value
on non-Windows machines.)
This prevents us from continually trying to re-lookup these values,
which could get racy if two different threads are each calling
git_sysdir_get and trying to lookup / clear the value simultaneously.
Fixes #3871