I forgot to send this patch last night. I was browsing through the code and
noticed these "return NULL"s for what I think are probably really fatal
conditions.
Here's a patch which switches them to internal_exceptions. Hopefully i'm
not missing the point here.
--Josh
Index: chartype.c
===================================================================
RCS file: /cvs/public/parrot/chartype.c,v
retrieving revision 1.4
diff -u -r1.4 chartype.c
--- chartype.c 17 Mar 2002 06:44:41 -0000 1.4
+++ chartype.c 28 Mar 2002 17:27:26 -0000
@@ -27,7 +27,7 @@
return &unicode_chartype;
}
else {
- return NULL;
+ internal_exception(INVALID_CHARTYPE, "Invalid chartype '%s'\n", name);
}
}
Index: encoding.c
===================================================================
RCS file: /cvs/public/parrot/encoding.c,v
retrieving revision 1.4
diff -u -r1.4 encoding.c
--- encoding.c 17 Mar 2002 06:44:41 -0000 1.4
+++ encoding.c 28 Mar 2002 17:27:26 -0000
@@ -35,7 +35,7 @@
return &utf32_encoding;
}
else {
- return NULL;
+ internal_exception(INVALID_ENCODING, "Invalid encoding '%s'\n", name);
}
}
Index: include/parrot/exceptions.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/exceptions.h,v
retrieving revision 1.16
diff -u -r1.16 exceptions.h
--- include/parrot/exceptions.h 4 Mar 2002 03:17:21 -0000 1.16
+++ include/parrot/exceptions.h 28 Mar 2002 17:27:26 -0000
@@ -30,6 +30,8 @@
#define MALFORMED_UTF16 1
#define MALFORMED_UTF32 1
#define INVALID_CHARACTER 1
+#define INVALID_CHARTYPE 1
+#define INVALID_ENCODING 1
#define NEG_REPEAT 1
#define NEG_SUBSTR 1
#define NEG_SLEEP 1