diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-06 20:40:11 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-06 20:40:11 (GMT) |
commit | d8d33378ed06f1dfb5118a9b961d179e55420b44 (patch) | |
tree | f8c2ee1129c12518caf8aa2b75c0ba0ba3b04d62 /wrapper.c | |
parent | ed45be76345454ab74454382953cb2de868c8cdb (diff) | |
parent | c21919f1b25cf7008018e8724e92dc771057c268 (diff) | |
download | git-d8d33378ed06f1dfb5118a9b961d179e55420b44.zip git-d8d33378ed06f1dfb5118a9b961d179e55420b44.tar.gz git-d8d33378ed06f1dfb5118a9b961d179e55420b44.tar.bz2 |
Merge branch 'ab/repo-settings-cleanup'
Code cleanup.
* ab/repo-settings-cleanup:
repository.h: don't use a mix of int and bitfields
repo-settings.c: simplify the setup
read-cache & fetch-negotiator: check "enum" values in switch()
environment.c: remove test-specific "ignore_untracked..." variable
wrapper.c: add x{un,}setenv(), and use xsetenv() in environment.c
Diffstat (limited to 'wrapper.c')
-rw-r--r-- | wrapper.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -145,6 +145,18 @@ void *xcalloc(size_t nmemb, size_t size) return ret; } +void xsetenv(const char *name, const char *value, int overwrite) +{ + if (setenv(name, value, overwrite)) + die_errno(_("could not setenv '%s'"), name ? name : "(null)"); +} + +void xunsetenv(const char *name) +{ + if (!unsetenv(name)) + die_errno(_("could not unsetenv '%s'"), name ? name : "(null)"); +} + /* * Limit size of IO chunks, because huge chunks only cause pain. OS X * 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in |