Re: svn: /pecl/rrd/trunk/ rrd.c
| From: | Johannes Schlüter | Date: | Sun, 08 Aug 2010 19:30:00 +0000 |
| Subject: | Re: svn: /pecl/rrd/trunk/ rrd.c | ||
| References: | 1 | Groups: | php.pecl.cvs |
| Request: | Send a blank email to pecl-cvs+get-14560@lists.php.net to get a copy of this message | ||
Hi,
small comment here, too:
On Sun, 2010-08-08 at 18:01 +0000, Miroslav Kubelik wrote:
> Modified: pecl/rrd/trunk/rrd.c
> ===================================================================
> --- pecl/rrd/trunk/rrd.c 2010-08-08 17:32:14 UTC (rev 302001)
> +++ pecl/rrd/trunk/rrd.c 2010-08-08 18:01:05 UTC (rev 302002)
> @@ -145,11 +145,39 @@
> }
> /* }}} */
>
> +/* {{{ proto int rrd_first(string file [, int rraindex = 0])
> + Gets first update time of an RRD file
> +*/
> +PHP_FUNCTION(rrd_first)
> +{
> + RETURN_LONG(rrd_first_r(filename, rraindex));
> +}
Something like this might make a nicer PHP API:
time_t rrd_first = rrd_first_r(filename, rraindex);
if (rrd_first == -1) {
/* maybe emit a notice/warning */
RETURN_FALSE;
} else {
RETURN_LONG(rrd_first);
}
Issue there is of course that 0 might be a valid return value and 0 ==
false. But PHP has an explicit false type so using it is quite nice. I
don't know much about rrdtool so I can't judge. (This might affect other
places in the code, too, as if this is done it should be consistent)
johannes