diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-07-10 11:53:01 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-07-10 11:53:01 +0000 |
commit | df912e3540968a2a0b266e523ecc08bb2dc0ca20 (patch) | |
tree | c2c59d025e08aab048b251d1711ed655cdf115f6 /environ.c | |
parent | a3391692ad5800ca034bbbdcd803924fc4e392ee (diff) |
xfree is not particularly helpful, remove it. From Thomas Adam.
Diffstat (limited to 'environ.c')
-rw-r--r-- | environ.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -51,10 +51,9 @@ environ_free(struct environ *env) while (!RB_EMPTY(env)) { envent = RB_ROOT(env); RB_REMOVE(environ, env, envent); - xfree(envent->name); - if (envent->value != NULL) - xfree(envent->value); - xfree(envent); + free(envent->name); + free(envent->value); + free(envent); } } @@ -85,8 +84,7 @@ environ_set(struct environ *env, const char *name, const char *value) struct environ_entry *envent; if ((envent = environ_find(env, name)) != NULL) { - if (envent->value != NULL) - xfree(envent->value); + free(envent->value); if (value != NULL) envent->value = xstrdup(value); else @@ -117,7 +115,7 @@ environ_put(struct environ *env, const char *var) name[strcspn(name, "=")] = '\0'; environ_set(env, name, value); - xfree(name); + free(name); } /* Unset an environment variable. */ @@ -129,10 +127,9 @@ environ_unset(struct environ *env, const char *name) if ((envent = environ_find(env, name)) == NULL) return; RB_REMOVE(environ, env, envent); - xfree(envent->name); - if (envent->value != NULL) - xfree(envent->value); - xfree(envent); + free(envent->name); + free(envent->value); + free(envent); } /* @@ -152,7 +149,7 @@ environ_update(const char *vars, struct environ *srcenv, struct environ *dstenv) else environ_set(dstenv, envent->name, envent->value); } - xfree(copyvars); + free(copyvars); } /* Push environment into the real environment - use after fork(). */ |