[Zope-CVS] CVS: Packages/ContextWrapper - wrapper.c:1.10

Fred Drake Jr fdrake@acm.org
Fri, 16 Nov 2001 16:25:17 -0500


Update of /cvs-repository/Packages/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv8446

Modified Files:
	wrapper.c 
Log Message:
Avoid macros that were only used once (or not at all!).

=== Packages/ContextWrapper/wrapper.c 1.9 => 1.10 ===
 
 
-#define WRAP_UNARY(method, generic) \
-    static PyObject * \
-    method(PyObject *wrapper) { \
-        return generic(Wrapper_GetObject(wrapper)); \
-    }
-
-#define WRAP_BINARY(method, generic) \
-    static PyObject * \
-    method(PyObject *wrapper, PyObject *v) { \
-        return generic(Wrapper_GetObject(wrapper), v); \
-    }
-
-#define WRAP_TERNARY(method, generic) \
-    static PyObject * \
-    method(PyObject *wrapper, PyObject *v, PyObject *w) { \
-        return generic(Wrapper_GetObject(wrapper), v, w); \
-    }
-
-
-WRAP_UNARY(wrap_str, PyObject_Str)
 static int
 wrap_init(PyObject *self, PyObject *args, PyObject *kwds)
 {
@@ -132,6 +112,11 @@
 }
 
 static PyObject *
+wrap_str(PyObject *wrapper) {
+    return PyObject_Str(Wrapper_GetObject(wrapper));
+}
+
+static PyObject *
 wrap_repr(PyObject *wrapper)
 {
     return PyObject_Repr(Wrapper_GetObject(wrapper));
@@ -188,7 +173,10 @@
  *   Mapping methods
  */
 
-WRAP_BINARY(wrap_getitem, PyObject_GetItem)
+static PyObject *
+wrap_getitem(PyObject *wrapper, PyObject *v) {
+    return PyObject_GetItem(Wrapper_GetObject(wrapper), v);
+}
 
 static int
 wrap_setitem(PyObject *self, PyObject *key, PyObject *value)