aboutsummaryrefslogtreecommitdiffhomepage
path: root/proc.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-28 15:11:46 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-29 16:14:51 -0800
commit909d24cde6acf87587370355d7a9cbc7dc18435c (patch)
treee859cfa7d3d39998affe6ce42bb44d47977a804b /proc.h
parent4e912ef83df234d34fff4156cd2bfb165e113674 (diff)
More work on improving interaction between fork and pthreads. Added null_terminated_array_t class.
Diffstat (limited to 'proc.h')
-rw-r--r--proc.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/proc.h b/proc.h
index 41a263ea..d91cfd9b 100644
--- a/proc.h
+++ b/proc.h
@@ -128,15 +128,13 @@ enum
class process_t
{
private:
- /** argv parameter for for execv, builtin_run, etc. This is allocated via new, and furthermore, each string within it is allocated via new as well. Null terminated. */
- wchar_t **argv_array;
-
- void free_argv(void);
+
+ null_terminated_array_t<wchar_t> argv_array;
public:
process_t() :
- argv_array(NULL),
+ argv_array(),
type(0),
actual_cmd(NULL),
pid(0),
@@ -158,7 +156,6 @@ class process_t
{
if (this->next != NULL)
delete this->next;
- this->free_argv();
free((void *)actual_cmd); //may be NULL
}
@@ -171,16 +168,16 @@ class process_t
/** Sets argv */
- void set_argv(const wcstring_list_t &argv);
+ void set_argv(const wcstring_list_t &argv) { argv_array.set(argv); }
/** Returns argv */
- const wchar_t * const *get_argv(void) const { return argv_array; }
+ const wchar_t * const *get_argv(void) const { return argv_array.get(); }
/** Returns argv[0] */
- const wchar_t *argv0(void) const { return argv_array[0]; }
+ const wchar_t *argv0(void) const { return argv_array.get()[0]; }
/** Returns argv[idx] */
- const wchar_t *argv(size_t idx) const { return argv_array[idx]; }
+ const wchar_t *argv(size_t idx) const { return argv_array.get()[idx]; }
/** actual command to pass to exec in case of EXTERNAL or INTERNAL_EXEC. malloc'd! */
const wchar_t *actual_cmd;