Add os_getfullenv_size/os_copyfullenv

This commit is contained in:
James McCoy
2019-06-02 14:36:17 -04:00
parent 19b6237087
commit 6dc1005787
3 changed files with 148 additions and 59 deletions

View File

@@ -272,15 +272,6 @@ static void close_cb(Stream *stream, void *data)
channel_decref(data);
}
static inline void free_env(char **env)
{
if (!env) { return; }
for (char **it = env; *it; it++) {
XFREE_CLEAR(*it);
}
xfree(env);
}
/// Starts a job and returns the associated channel
///
@@ -362,7 +353,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout,
if (status) {
EMSG3(_(e_jobspawn), os_strerror(status), cmd);
xfree(cmd);
free_env(proc->env);
os_free_fullenv(proc->env);
if (proc->type == kProcessTypePty) {
xfree(chan->stream.pty.term_name);
}
@@ -371,7 +362,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout,
return NULL;
}
xfree(cmd);
free_env(proc->env);
os_free_fullenv(proc->env);
wstream_init(&proc->in, 0);