diff src/variables.cc @ 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 89f4d7e294cc
line wrap: on
line diff
--- a/src/variables.cc	Tue May 18 08:19:41 2010 +0200
+++ b/src/variables.cc	Tue May 18 08:34:02 2010 +0200
@@ -873,10 +873,12 @@
 
 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)
 {
   octave_value retval;
+  int nchoices = 0;
+  while (choices[nchoices] != 0)
+    nchoices++;
 
   int nargin = args.length ();
   assert (var < nchoices);