1#include "../git-compat-util.h"
2
3void gitunsetenv (const char *name)
4{
5 int src, dst;
6 size_t nmln;
7
8 nmln = strlen(name);
9
10 for (src = dst = 0; environ[src]; ++src) {
11 size_t enln;
12 enln = strlen(environ[src]);
13 if (enln > nmln) {
14 /* might match, and can test for '=' safely */
15 if (0 == strncmp (environ[src], name, nmln)
16 && '=' == environ[src][nmln])
17 /* matches, so skip */
18 continue;
19 }
20 environ[dst] = environ[src];
21 ++dst;
22 }
23 environ[dst] = NULL;
24}