[svn:parrot] r49293 - branches/string_macros/src/string

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Fri Sep 24 11:16:41 UTC 2010


Author: nwellnhof
Date: Fri Sep 24 11:16:41 2010
New Revision: 49293
URL: https://trac.parrot.org/parrot/changeset/49293

Log:
[str] Change check for NULL keys in string API

Modified:
   branches/string_macros/src/string/api.c

Modified: branches/string_macros/src/string/api.c
==============================================================================
--- branches/string_macros/src/string/api.c	Fri Sep 24 11:16:21 2010	(r49292)
+++ branches/string_macros/src/string/api.c	Fri Sep 24 11:16:41 2010	(r49293)
@@ -776,8 +776,7 @@
     ASSERT_ARGS(Parrot_str_indexed)
 
     if (s == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s = STRINGNULL;
 
     return STRING_ord(interp, s, idx);
 }
@@ -809,8 +808,7 @@
     ASSERT_ARGS(Parrot_str_find_index)
 
     if (src == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        src = STRINGNULL;
 
     return STRING_index(interp, src, search, start);
 }
@@ -835,8 +833,7 @@
     ASSERT_ARGS(string_ord)
 
     if (s == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s = STRINGNULL;
 
     return STRING_ord(interp, s, idx);
 }
@@ -985,8 +982,7 @@
     ASSERT_ARGS(Parrot_str_substr)
 
     if (src == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        src = STRINGNULL;
 
     return STRING_substr(interp, src, offset, length);
 }
@@ -1271,8 +1267,7 @@
     ASSERT_ARGS(Parrot_str_compare)
 
     if (s1 == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s1 = STRINGNULL;
 
     return STRING_compare(interp, s1, s2);
 }
@@ -1298,8 +1293,7 @@
     ASSERT_ARGS(Parrot_str_not_equal)
 
     if (s1 == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s1 = STRINGNULL;
 
     return !STRING_equal(interp, s1, s2);
 }
@@ -1329,8 +1323,7 @@
     ASSERT_ARGS(Parrot_str_equal)
 
     if (s1 == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s1 = STRINGNULL;
 
     return STRING_equal(interp, s1, s2);
 }
@@ -2242,8 +2235,7 @@
     ASSERT_ARGS(Parrot_str_to_hashval)
 
     if (s == NULL)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
-            "Invalid operation on null string");
+        s = STRINGNULL;
 
     return STRING_hash(interp, s, interp->hash_seed);
 }


More information about the parrot-commits mailing list