Re: getting new RRA entries since last update

Sebastian Harl <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
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

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkvFpEEACgkQEFEKc4UBx/xh2ACfXKDAu12Nk+EpieNr8yvm0SeL
DgsAnRY+l1jkTJze8sL38E1j/b2iMEop
=sz/8
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.