octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61537] mxAddField too strict on field validat


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #61537] mxAddField too strict on field validation
Date: Wed, 24 Nov 2021 06:47:26 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #1, bug #61537 (project octave):

This change should allow mxAddField to accept leading underscores:


diff --git a/libinterp/corefcn/mex.cc b/libinterp/corefcn/mex.cc
--- a/libinterp/corefcn/mex.cc
+++ b/libinterp/corefcn/mex.cc
@@ -286,7 +286,7 @@ valid_key (const char *key)
 
   if (nel > 0)
     {
-      if (isalpha (key[0]))
+      if (isalpha (key[0]) || key[0] == '_')
         {
           for (int i = 1; i < nel; i++)
             {


but before I commit this change, what are the correct rules for field names
according to Matlab?  Do they have to be valid identifiers
([_A-Za-z][_A-Za-z0-9]*) or are more characters allowed?  I think Octave
allows any characters now.  Should we allow the same for the mex interface?

If we do place restrictions on the field names, then I suppose we should also
check for valid keys in the mxArray_struct::init function.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61537>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]