Heya,
On Wed, Apr 14, 2010 at 11:33:49AM +0200, Frederik Kriewitz wrote:
> rrd_update_v() works but results in some ugly code including a malloc
> which souldn't be necessary:
>
> /* We need to use rrd_update_v and construct update_argv because
> rrd_update_r doesn't allow us to use the rrd_info_t * pcdp_summary
> parameter of _rrd_update() */
> int update_argc = values_num + 2;
> char **update_argv = (char**) malloc (update_argc * sizeof (char*));
> if (update_argv == NULL)
> {
[…]
> }
> else
> {
[…]
> free(update_argv);
> }In fact, that malloc can be avoided (using C99 features [1]): int update_argc = values_num + 2; char *update_argv[update_argc]; *SCNR* Cheers, Sebastian [1] <http://en.wikipedia.org/wiki/Variable-length_array> -- Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
signature.asc
Description: Digital signature
_______________________________________________ rrd-developers mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
