diff src/variables.h @ 10640:5c594472f75e

determine string enum length by trailing null rather than sizeof
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 18 May 2010 08:34:02 +0200
parents e1559a8a60b4
children fd0a3ac60b0e
line wrap: on
line diff
--- a/src/variables.h	Tue May 18 08:19:41 2010 +0200
+++ b/src/variables.h	Tue May 18 08:34:02 2010 +0200
@@ -111,8 +111,7 @@
 
 extern OCTINTERP_API octave_value
 set_internal_variable (int& var, const octave_value_list& args,
-                       int nargout, const char *nm, const char **choices,
-                       int nchoices);
+                       int nargout, const char *nm, const char **choices);
 
 #define SET_INTERNAL_VARIABLE(NM) \
   set_internal_variable (V ## NM, args, nargout, #NM)
@@ -123,10 +122,9 @@
 #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \
   set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)
 
-// in the following, CHOICES must be a static C string array.
+// in the following, CHOICES must be a C string array terminated by null.
 #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \
-  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES, \
-                         sizeof (CHOICES) / sizeof (const char *))
+  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)
 
 extern OCTINTERP_API std::string builtin_string_variable (const std::string&);
 extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, double&);