[svn:parrot] r40942 - trunk/src/interp

cotto at svn.parrot.org cotto at svn.parrot.org
Thu Sep 3 02:26:55 UTC 2009


Author: cotto
Date: Thu Sep  3 02:26:54 2009
New Revision: 40942
URL: https://trac.parrot.org/parrot/changeset/40942

Log:
[string] replace more ->strstart abuse, patch from darbelo++

Modified:
   trunk/src/interp/inter_cb.c

Modified: trunk/src/interp/inter_cb.c
==============================================================================
--- trunk/src/interp/inter_cb.c	Thu Sep  3 02:20:48 2009	(r40941)
+++ trunk/src/interp/inter_cb.c	Thu Sep  3 02:26:54 2009	(r40942)
@@ -79,6 +79,7 @@
     int type;
     char * sig_str;
     STRING *sc;
+    char * const signature = Parrot_str_to_cstring(interp, cb_signature);
     /*
      * we stuff all the information into the user_data PMC and pass that
      * on to the external sub
@@ -92,11 +93,13 @@
     sc = CONST_STRING(interp, "_sub");
     VTABLE_setprop(interp, user_data, sc, sub);
     /* only ASCII signatures are supported */
-    sig_str = cb_signature->strstart;
+    sig_str = signature;
 
-    if (strlen(sig_str) != 3)
+    if (strlen(sig_str) != 3) {
+        mem_sys_free(signature);
         Parrot_ex_throw_from_c_args(interp, NULL, 1,
-            "unhandled signature '%s' in make_cb", cb_signature->strstart);
+            "unhandled signature '%Ss' in make_cb", cb_signature);
+    }
 
     ++sig_str;     /* Skip callback return type */
 
@@ -109,11 +112,13 @@
             type = 'C';
         }
         else {
+            mem_sys_free(signature);
             Parrot_ex_throw_from_c_args(interp, NULL, 1,
-                "unhandled signature '%s' in make_cb", cb_signature->strstart);
+                "unhandled signature '%Ss' in make_cb", cb_signature);
         }
     }
 
+    mem_sys_free(signature);
     cb_sig = pmc_new(interp, enum_class_String);
     VTABLE_set_string_native(interp, cb_sig, cb_signature);
     sc = CONST_STRING(interp, "_signature");


More information about the parrot-commits mailing list