Avoid enum as function argument for headerConvert()
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 17 Nov 2010 06:46:21 +0000 (08:46 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 17 Nov 2010 06:46:21 +0000 (08:46 +0200)
- While this /nearly/ qualifies for enum, places like python
  argument converting will not be able to produce "true enum" values.
  So dont even try.

lib/header.h
lib/legacy.c
python/header-py.c

index dab5070..b39f57a 100644 (file)
@@ -434,10 +434,10 @@ typedef enum headerConvOps_e {
 /** \ingroup header
  * Convert header to/from (legacy) data presentation
  * @param h            header
- * @param op           operation
+ * @param op           one of headerConvOps operations
  * @return             1 on success, 0 on failure
  */
-int headerConvert(Header h, headerConvOps op);
+int headerConvert(Header h, int op);
 
 #ifdef __cplusplus
 }
index 9765d27..df7911e 100644 (file)
@@ -207,7 +207,7 @@ static void legacyRetrofit(Header h)
     }
 }
 
-int headerConvert(Header h, headerConvOps op)
+int headerConvert(Header h, int op)
 {
     int rc = 1;
 
index c83b1a2..b6e21cc 100644 (file)
@@ -257,7 +257,7 @@ static int hdrContains(hdrObject *s, PyObject *pytag)
 static PyObject *hdrConvert(hdrObject *self, PyObject *args, PyObject *kwds)
 {
     char *kwlist[] = {"op", NULL};
-    headerConvOps op = -1;
+    int op = -1;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", kwlist, &op)) {
         return NULL;