[PyObjC-svn] r2400 - trunk/pyobjc/pyobjc-core/Modules/objc

[email protected] Wed, 03 Feb 2010 15:39:29 -0600
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Wed Feb  3 15:39:29 2010
New Revision: 2400

Log:
Don't bother to set boolean values in the python datastructures that
the xml parser creates when those values are the default. This should
reduce memory uage.

Thanks to Virgil Dupras for the tip.


Modified:
   trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m	Wed Feb  3 15:39:29 2010
@@ -338,17 +338,29 @@
 	for (; *bool_attrs != NULL; bool_attrs++) {
 		if (attribute_bool(node, *bool_attrs, NULL, NO)) {
 			r = PyDict_SetItemString(result, *bool_attrs, Py_True);
+			if (r == -1) {
+				Py_DECREF(result);
+				return NULL;
+			}
+#if 0
+		/* Don't store default value */
 		} else {
 			r = PyDict_SetItemString(result, *bool_attrs, Py_False);
-		}
-		if (r == -1) {
-			Py_DECREF(result);
-			return NULL;
+			if (r == -1) {
+				Py_DECREF(result);
+				return NULL;
+			}
+#endif
 		}
 	}
 
 	if (attribute_bool(node, "null_accepted", NULL, YES)) {
+#if 0
+		/* Don't store default value */
 		r = PyDict_SetItemString(result, "null_accepted", Py_True);
+#else
+		r = 0;
+#endif
 	} else {
 		r = PyDict_SetItemString(result, "null_accepted", Py_False);
 	}

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com