Commit eb5c2b54 authored by Jim Fulton's avatar Jim Fulton

Combined macros onto one line to keep from messing up gdb.

Fixed memory leak caused by incomplete PER_DEL.
parent e3c65066
...@@ -89,14 +89,7 @@ ...@@ -89,14 +89,7 @@
#include "ExtensionClass.h" #include "ExtensionClass.h"
#include <time.h> #include <time.h>
#define cPersistent_HEAD PyObject_HEAD \ #define cPersistent_HEAD PyObject_HEAD PyObject *jar, *oid; char serial[8]; unsigned short atime; signed char state; unsigned char reserved;
PyObject *jar; \
PyObject *oid; \
char serial[8]; \
unsigned short atime; \
signed char state; \
unsigned char reserved; \
#define cPersistent_GHOST_STATE -1 #define cPersistent_GHOST_STATE -1
#define cPersistent_UPTODATE_STATE 0 #define cPersistent_UPTODATE_STATE 0
#define cPersistent_CHANGED_STATE 1 #define cPersistent_CHANGED_STATE 1
...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
#define PER_USE_OR_RETURN(O,R) { \ #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
if ((O)->state==cPersistent_GHOST_STATE && \
cPersistenceCAPI->setstate((PyObject*)(O)) < 0) \
return (R); \
else if ((O)->state==cPersistent_UPTODATE_STATE) \
(O)->state=cPersistent_STICKY_STATE; \
}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
#define PER_ALLOW_DEACTIVATION(O) \ #define PER_ALLOW_DEACTIVATION(O) ((O)->state==cPersistent_STICKY_STATE && ((O)->state=cPersistent_UPTODATE_STATE))
((O)->state==cPersistent_STICKY_STATE && \
((O)->state=cPersistent_UPTODATE_STATE))
#define PER_PREVENT_DEACTIVATION(O) \ #define PER_PREVENT_DEACTIVATION(O) ((O)->state==cPersistent_UPTODATE_STATE && ((O)->state=cPersistent_STICKY_STATE))
((O)->state==cPersistent_UPTODATE_STATE && \
((O)->state=cPersistent_STICKY_STATE))
#define PER_DEL(O) Py_XDECREF((O)->jar) #define PER_DEL(O) Py_XDECREF((O)->jar); Py_XDECREF((O)->oid);
#endif #endif
......
...@@ -89,14 +89,7 @@ ...@@ -89,14 +89,7 @@
#include "ExtensionClass.h" #include "ExtensionClass.h"
#include <time.h> #include <time.h>
#define cPersistent_HEAD PyObject_HEAD \ #define cPersistent_HEAD PyObject_HEAD PyObject *jar, *oid; char serial[8]; unsigned short atime; signed char state; unsigned char reserved;
PyObject *jar; \
PyObject *oid; \
char serial[8]; \
unsigned short atime; \
signed char state; \
unsigned char reserved; \
#define cPersistent_GHOST_STATE -1 #define cPersistent_GHOST_STATE -1
#define cPersistent_UPTODATE_STATE 0 #define cPersistent_UPTODATE_STATE 0
#define cPersistent_CHANGED_STATE 1 #define cPersistent_CHANGED_STATE 1
...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
#define PER_USE_OR_RETURN(O,R) { \ #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
if ((O)->state==cPersistent_GHOST_STATE && \
cPersistenceCAPI->setstate((PyObject*)(O)) < 0) \
return (R); \
else if ((O)->state==cPersistent_UPTODATE_STATE) \
(O)->state=cPersistent_STICKY_STATE; \
}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
#define PER_ALLOW_DEACTIVATION(O) \ #define PER_ALLOW_DEACTIVATION(O) ((O)->state==cPersistent_STICKY_STATE && ((O)->state=cPersistent_UPTODATE_STATE))
((O)->state==cPersistent_STICKY_STATE && \
((O)->state=cPersistent_UPTODATE_STATE))
#define PER_PREVENT_DEACTIVATION(O) \ #define PER_PREVENT_DEACTIVATION(O) ((O)->state==cPersistent_UPTODATE_STATE && ((O)->state=cPersistent_STICKY_STATE))
((O)->state==cPersistent_UPTODATE_STATE && \
((O)->state=cPersistent_STICKY_STATE))
#define PER_DEL(O) Py_XDECREF((O)->jar) #define PER_DEL(O) Py_XDECREF((O)->jar); Py_XDECREF((O)->oid);
#endif #endif
......
...@@ -89,14 +89,7 @@ ...@@ -89,14 +89,7 @@
#include "ExtensionClass.h" #include "ExtensionClass.h"
#include <time.h> #include <time.h>
#define cPersistent_HEAD PyObject_HEAD \ #define cPersistent_HEAD PyObject_HEAD PyObject *jar, *oid; char serial[8]; unsigned short atime; signed char state; unsigned char reserved;
PyObject *jar; \
PyObject *oid; \
char serial[8]; \
unsigned short atime; \
signed char state; \
unsigned char reserved; \
#define cPersistent_GHOST_STATE -1 #define cPersistent_GHOST_STATE -1
#define cPersistent_UPTODATE_STATE 0 #define cPersistent_UPTODATE_STATE 0
#define cPersistent_CHANGED_STATE 1 #define cPersistent_CHANGED_STATE 1
...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -125,25 +118,15 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
#define PER_USE_OR_RETURN(O,R) { \ #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
if ((O)->state==cPersistent_GHOST_STATE && \
cPersistenceCAPI->setstate((PyObject*)(O)) < 0) \
return (R); \
else if ((O)->state==cPersistent_UPTODATE_STATE) \
(O)->state=cPersistent_STICKY_STATE; \
}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
#define PER_ALLOW_DEACTIVATION(O) \ #define PER_ALLOW_DEACTIVATION(O) ((O)->state==cPersistent_STICKY_STATE && ((O)->state=cPersistent_UPTODATE_STATE))
((O)->state==cPersistent_STICKY_STATE && \
((O)->state=cPersistent_UPTODATE_STATE))
#define PER_PREVENT_DEACTIVATION(O) \ #define PER_PREVENT_DEACTIVATION(O) ((O)->state==cPersistent_UPTODATE_STATE && ((O)->state=cPersistent_STICKY_STATE))
((O)->state==cPersistent_UPTODATE_STATE && \
((O)->state=cPersistent_STICKY_STATE))
#define PER_DEL(O) Py_XDECREF((O)->jar) #define PER_DEL(O) Py_XDECREF((O)->jar); Py_XDECREF((O)->oid);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment