[svn:parrot] r42267 - in trunk: include/parrot src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Nov 5 12:39:47 UTC 2009


Author: NotFound
Date: Thu Nov  5 12:39:45 2009
New Revision: 42267
URL: https://trac.parrot.org/parrot/changeset/42267

Log:
check for null string in Parrot_oo_get_class_str, TT #1107

Modified:
   trunk/include/parrot/oo.h
   trunk/src/oo.c

Modified: trunk/include/parrot/oo.h
==============================================================================
--- trunk/include/parrot/oo.h	Thu Nov  5 11:01:00 2009	(r42266)
+++ trunk/include/parrot/oo.h	Thu Nov  5 12:39:45 2009	(r42267)
@@ -133,9 +133,8 @@
 PARROT_EXPORT
 PARROT_CAN_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
-PMC * Parrot_oo_get_class_str(PARROT_INTERP, ARGIN(STRING *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+PMC * Parrot_oo_get_class_str(PARROT_INTERP, ARGIN_NULLOK(STRING *name))
+        __attribute__nonnull__(1);
 
 void destroy_object_cache(PARROT_INTERP)
         __attribute__nonnull__(1);
@@ -221,8 +220,7 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(key))
 #define ASSERT_ARGS_Parrot_oo_get_class_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(name))
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_destroy_object_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_init_object_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\

Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c	Thu Nov  5 11:01:00 2009	(r42266)
+++ trunk/src/oo.c	Thu Nov  5 12:39:45 2009	(r42267)
@@ -395,10 +395,13 @@
 PARROT_CAN_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC *
-Parrot_oo_get_class_str(PARROT_INTERP, ARGIN(STRING *name))
+Parrot_oo_get_class_str(PARROT_INTERP, ARGIN_NULLOK(STRING *name))
 {
     ASSERT_ARGS(Parrot_oo_get_class_str)
 
+    if (STRING_IS_NULL(name))
+        return PMCNULL;
+
     /* First check in current HLL namespace */
     PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
                            Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));


More information about the parrot-commits mailing list