7 rrd_args_t *ra_create (void) /* {{{ */
11 ra = malloc (sizeof (*ra));
14 memset (ra, 0, sizeof (*ra));
16 ra->options = array_create ();
17 ra->data = array_create ();
18 ra->calc = array_create ();
19 ra->draw = array_create ();
21 if ((ra->options == NULL)
24 || (ra->draw == NULL))
31 } /* }}} rrd_args_t *ra_create */
33 void ra_destroy (rrd_args_t *ra) /* {{{ */
38 array_destroy (ra->options);
39 array_destroy (ra->data);
40 array_destroy (ra->calc);
41 array_destroy (ra->draw);
44 } /* }}} void ra_destroy */
46 int ra_argc (rrd_args_t *ra)
51 return (array_argc (ra->options)
52 + array_argc (ra->data)
53 + array_argc (ra->calc)
54 + array_argc (ra->draw));
55 } /* }}} int ra_argc */
57 char **ra_argv (rrd_args_t *ra) /* {{{ */
73 argv = calloc (argc + 1, sizeof (*argv));
80 #define APPEND_FIELD(field) do \
85 ary_argc = (size_t) array_argc (ra->field); \
86 ary_argv = array_argv (ra->field); \
87 if ((ary_argc > 0) && (ary_argv != NULL)) \
89 memcpy (argv + pos, ary_argv, ary_argc * sizeof (*ary_argv)); \
95 APPEND_FIELD (options);
103 } /* }}} char **ra_argv */
105 void ra_argv_free (char **argv) /* {{{ */
107 /* The pointers contained in the "argv" come from "array_argv". We don't need
108 * to free them. We only need to free what we actually alloced directly in
111 } /* }}} void ra_argv_free */
113 /* vim: set sw=2 sts=2 et fdm=marker : */