[Zope3-checkins] CVS: ZODB4/Persistence - cPersistenceAPI.h:1.8

Jeremy Hylton jeremy@zope.com
Thu, 17 Oct 2002 16:00:23 -0400


Update of /cvs-repository/ZODB4/Persistence
In directory cvs.zope.org:/tmp/cvs-serv19003/Persistence

Modified Files:
	cPersistenceAPI.h 
Log Message:
Repair memory leaks in cPersistence C API (collector #83).

The _PyPersist_Load() and _PyPersist_RegistrDataManager() functions
were leaking their return values.  Fixed by changing them to return
int instead of PyObject *, as suggested by Phillip J. Eby.  This may
require apps written against the C API to change.

Some of the macros defined in cPersistenceAPI.h now return non-zero
ints on success, zero on failure.


=== ZODB4/Persistence/cPersistenceAPI.h 1.7 => 1.8 ===
--- ZODB4/Persistence/cPersistenceAPI.h:1.7	Thu Oct 10 17:36:18 2002
+++ ZODB4/Persistence/cPersistenceAPI.h	Thu Oct 17 16:00:23 2002
@@ -50,7 +50,7 @@
 #define PER_USE_OR_RETURN(O, R) \
 { \
     if (((O)->po_state == GHOST) \
-	&& (PyPersist_C_API->load((PyPersistObject *)(O)) < 0)) { \
+	&& (!PyPersist_C_API->load((PyPersistObject *)(O)))) { \
         (O)->po_state = STICKY; \
 	return (R); \
     } else if ((O)->po_state == UPTODATE) \
@@ -73,7 +73,7 @@
 
 #define PER_USE(O) \
     ((((PyPersistObject *)(O))->po_state != GHOST) \
-     || (PyPersist_C_API->load((PyPersistObject *)(O)) >= 0) \
+     || (PyPersist_C_API->load((PyPersistObject *)(O))) \
      ? ((((PyPersistObject *)(O))->po_state == UPTODATE) \
 	? (((PyPersistObject *)(O))->po_state = STICKY) : 1) : 0)