summaryrefslogtreecommitdiffstats
path: root/Mac/Python
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-12-17 17:15:50 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-12-17 17:15:50 (GMT)
commitb734adef4b0a263bd28a94fbb6463e8295508926 (patch)
tree84d76e5aadf2597190f915f78b688d8b02a4f6ce /Mac/Python
parenta07431f0ce719e24c73de5141634b8ea51cd2751 (diff)
downloadcpython-b734adef4b0a263bd28a94fbb6463e8295508926.zip
cpython-b734adef4b0a263bd28a94fbb6463e8295508926.tar.gz
cpython-b734adef4b0a263bd28a94fbb6463e8295508926.tar.bz2
Added PyMac_BuildOptStr255, which returns None on a null pointer.
Diffstat (limited to 'Mac/Python')
-rw-r--r--Mac/Python/macglue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 117911a..40cdfa2 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -826,6 +826,20 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf)
PyObject *
PyMac_BuildStr255(Str255 s)
{
+ if ( s == NULL ) {
+ PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL");
+ return NULL;
+ }
+ return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
+}
+
+PyObject *
+PyMac_BuildOptStr255(Str255 s)
+{
+ if ( s == NULL ) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
}