summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-06 20:40:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-06 20:40:11 (GMT)
commitd8d33378ed06f1dfb5118a9b961d179e55420b44 (patch)
treef8c2ee1129c12518caf8aa2b75c0ba0ba3b04d62 /wrapper.c
parented45be76345454ab74454382953cb2de868c8cdb (diff)
parentc21919f1b25cf7008018e8724e92dc771057c268 (diff)
downloadgit-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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/wrapper.c b/wrapper.c
index 7c6586a..1460d4e 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -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