[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed getitimer and setitimer functions
From: |
Martin Grabmueller |
Subject: |
Re: proposed getitimer and setitimer functions |
Date: |
Sat, 07 Jul 2001 10:32:53 +0200 |
> From: Rob Browning <address@hidden>
> Date: 06 Jul 2001 12:53:17 -0500
>
> +SCM_DEFINE (scm_setitimer, "setitimer", 5, 0, 0,
[...]
> + SCM_VALIDATE_INUM (1, which_timer);
> + SCM_VALIDATE_NUMBER (2, interval_seconds);
> + SCM_VALIDATE_NUMBER (3, interval_microseconds);
> + SCM_VALIDATE_NUMBER (4, value_seconds);
> + SCM_VALIDATE_NUMBER (5, value_microseconds);
> +
> + c_which_timer = SCM_INUM(which_timer);
> +
> + new_timer.it_interval.tv_sec = scm_num2long(interval_seconds, 0, NULL);
> + new_timer.it_interval.tv_usec = scm_num2long(interval_microseconds, 0,
> NULL);
> + new_timer.it_value.tv_sec = scm_num2long(value_seconds, 0, NULL);
> + new_timer.it_value.tv_usec = scm_num2long(value_microseconds, 0, NULL);
I have a comment about the code above. You are passing NULL to
scm_num2long because you checked with SCM_VALIDATE_NUMBER before.
This is not correct, because SCM_VALIDATE_NUMBER allows inexact
numbers and bignums. scm_num2long will throw an out-of-range error
when given an inexact number or one that does not fit into a long
variable, thus passing NULL as the caller's name to scm_out_of_range.
I don't know what happens when NULL is given as a function name, but I
suppose it will be at least less informative than passing FUNC_NAME.
Regards,
'martin
Re: proposed getitimer and setitimer functions, Rob Browning, 2001/07/09
Re: proposed getitimer and setitimer functions,
Martin Grabmueller <=
Re: proposed getitimer and setitimer functions, Rob Browning, 2001/07/29