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));
79 #define APPEND_FIELD(field) do \
84 ary_argc = (size_t) array_argc (ra->field); \
85 ary_argv = array_argv (ra->field); \
86 if ((ary_argc > 0) && (ary_argv != NULL)) \
88 memcpy (argv + pos, ary_argv, ary_argc * sizeof (*ary_argv)); \
95 APPEND_FIELD (options);
103 } /* }}} char **ra_argv */
105 /* vim: set sw=2 sts=2 et fdm=marker : */