[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 8/7] pygrub/fsimage: use named initialisation in extension



... and drop PY_PAD.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
This can be squashed into previous patch.
---
 tools/pygrub/src/fsimage/fsimage.c | 47 ++++++--------------------------------
 1 file changed, 7 insertions(+), 40 deletions(-)

diff --git a/tools/pygrub/src/fsimage/fsimage.c 
b/tools/pygrub/src/fsimage/fsimage.c
index cf8089a872..5483aefbfe 100644
--- a/tools/pygrub/src/fsimage/fsimage.c
+++ b/tools/pygrub/src/fsimage/fsimage.c
@@ -26,16 +26,6 @@
 #include <xenfsimage.h>
 #include <stdlib.h>
 
-#if PY_MAJOR_VERSION < 3
-#if (PYTHON_API_VERSION >= 1011)
-#define PY_PAD 
0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L
-#else
-#define PY_PAD 0L,0L,0L,0L
-#endif
-#else
-#define PY_PAD 0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L
-#endif
-
 typedef struct fsimage_fs {
        PyObject_HEAD
        fsi_t *fs;
@@ -150,40 +140,17 @@ fsimage_file_dealloc(fsimage_file_t *file)
 static char fsimage_file_type__doc__[] = "Filesystem image file";
 PyTypeObject fsimage_file_type = {
        PyVarObject_HEAD_INIT(&PyType_Type, 0)
-       "xenfsimage.file",                      /* tp_name */
-       sizeof(fsimage_file_t),                 /* tp_size */
-       0,                                      /* tp_itemsize */
-       (destructor) fsimage_file_dealloc,      /* tp_dealloc */
-       0,                                      /* tp_print */
+       .tp_name = "xenfsimage.file",
+       .tp_basicsize = sizeof(fsimage_file_t),
+       .tp_dealloc = (destructor) fsimage_file_dealloc,
 #if PY_MAJOR_VERSION < 3
-       (getattrfunc) fsimage_file_getattr,     /* tp_getattr */
-#else
-       0,                                      /* tp_getattr */
+       .tp_getattr = (getattrfunc) fsimage_file_getattr,
 #endif
-       0,                                      /* tp_setattr */
-       0,                                      /* tp_compare */
-       0,                                      /* tp_repr */
-       0,                                      /* tp_as_number */
-       0,                                      /* tp_as_sequence */
-       0,                                      /* tp_as_mapping */
-       0,                                      /* tp_hash */
-       0,                                      /* tp_call */
-       0,                                      /* tp_str */
-       0,                                      /* tp_getattro */
-       0,                                      /* tp_setattro */
-       0,                                      /* tp_as_buffer */
-       Py_TPFLAGS_DEFAULT,                     /* tp_flags */
-       fsimage_file_type__doc__,               /* tp_doc */
+       .tp_flags = Py_TPFLAGS_DEFAULT,
+       .tp_doc = fsimage_file_type__doc__,
 #if PY_MAJOR_VERSION >= 3
-       0,                                      /* tp_traverse */
-       0,                                      /* tp_clear */
-       0,                                      /* tp_richcompare */
-       0,                                      /* tp_weaklistoffset */
-       0,                                      /* tp_iter */
-       0,                                      /* tp_iternext */
-       fsimage_file_methods,                   /* tp_methods */
+       .tp_methods = fsimage_file_methods,
 #endif
-       PY_PAD
 };
 
 static PyObject *
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.