[rrd-developers] Re: RRDs.xs malloc to multi-dimensional array
Tobias Oetiker
oetiker at ee.ethz.ch
Tue Aug 13 22:51:16 MEST 2002
Today Alexandre CHERIF wrote:
>
> Re,
>
> Sorry the problem is not only in perl-shared...but in the lib too.
>
> ex:
> rrd_fetch:149
> /* when was the realy last update of this file ? */
>
> if (((*ds_namv) = (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
> rrd_set_error("malloc fetch ds_namv array");
> rrd_free(&rrd);
> fclose(in_file);
> return(-1);
> }
>
> for(i=0;i<rrd.stat_head->ds_cnt;i++){
> if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE))==NULL){
> <CUT>
>
> }
>
> again a malloc in a loop..with this time fixed size, it might be interesting to
> rewrite this part of code i can handle if everybody think it's not useless.
>
> Regard
Alexandre, ds_cnt is normally 2 or 3 or 20 in any event this will
no have a major impact I guess
tobi
>
>
>
>
>
--
______ __ _
/_ __/_ / / (_) Oetiker, ETZ J97, ETH, 8092 Zurich, Switzerland
/ // _ \/ _ \/ / phoneto:+41(0)1-632-5286 faxto:+41(0)1-632-1517
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://google.com/search?q=tobi
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list