summaryrefslogtreecommitdiff
path: root/psi/zfunc.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2018-12-03 14:59:55 +0000
committerChris Liddell <chris.liddell@artifex.com>2018-12-13 10:33:58 +0000
commit85bb44261edbf10552a09c839decc669f63a8142 (patch)
treee41f3756be4ba1b968e78b56cae826ad3125ca45 /psi/zfunc.c
parente280984683a5ca0f2d496a93d0333b4a89ab7f42 (diff)
downloadghostpdl-85bb44261edbf10552a09c839decc669f63a8142.tar.gz
Add an "r_is_number()" macro
By moving the t_integer and t_real enum values to consecutive positions, starting on a multiple of 2, we can check for a "number" type in a single step. Useful for values specced as reals, but which may be integer values, and thus parsed into integer objects. This means validation can be a single check, rather than checking for real and integer individually. Also use the macro in various places.
Diffstat (limited to 'psi/zfunc.c')
-rw-r--r--psi/zfunc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/psi/zfunc.c b/psi/zfunc.c
index 135c31682..8fb3d8671 100644
--- a/psi/zfunc.c
+++ b/psi/zfunc.c
@@ -306,7 +306,7 @@ fn_build_float_array_forced(const ref * op, const char *kstr, bool required,
if( r_is_array(par) )
size = r_size(par);
- else if(r_type(par) == t_integer || r_type(par) == t_real)
+ else if(r_is_number(par))
size = 1;
else
return_error(gs_error_typecheck);