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

[libvirt] [PATCH 2/5] python: drop redundant function



I noticed some redundant code while preparing my next patch.

* python/generator.py (py_types): Fix 'const char *' mapping.
* python/typewrappers.h (libvirt_charPtrConstWrap): Drop.
* python/typewrappers.c (libvirt_charPtrConstWrap): Delete, since
it is identical to libvirt_constcharPtrWrap.
---
 python/generator.py   |    2 +-
 python/typewrappers.c |   13 -------------
 python/typewrappers.h |    3 +--
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/python/generator.py b/python/generator.py
index b514af5..0728519 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -263,7 +263,7 @@ py_types = {
     'unsigned long long':  ('l', None, "longlong", "long long"),
     'unsigned char *':  ('z', None, "charPtr", "char *"),
     'char *':  ('z', None, "charPtr", "char *"),
-    'const char *':  ('z', None, "charPtrConst", "const char *"),
+    'const char *':  ('z', None, "constcharPtr", "const char *"),
     'size_t': ('n', None, "size_t", "size_t"),

     'virDomainPtr':  ('O', "virDomain", "virDomainPtr", "virDomainPtr"),
diff --git a/python/typewrappers.c b/python/typewrappers.c
index b5758b4..9021ce3 100644
--- a/python/typewrappers.c
+++ b/python/typewrappers.c
@@ -118,19 +118,6 @@ libvirt_constcharPtrWrap(const char *str)
 }

 PyObject *
-libvirt_charPtrConstWrap(const char *str)
-{
-    PyObject *ret;
-
-    if (str == NULL) {
-        Py_INCREF(Py_None);
-        return (Py_None);
-    }
-    ret = PyString_FromString(str);
-    return (ret);
-}
-
-PyObject *
 libvirt_virDomainPtrWrap(virDomainPtr node)
 {
     PyObject *ret;
diff --git a/python/typewrappers.h b/python/typewrappers.h
index 87ea1e5..1e34dfa 100644
--- a/python/typewrappers.h
+++ b/python/typewrappers.h
@@ -1,7 +1,7 @@
 /*
  * libvirt_wrap.h: type wrappers for libvir python bindings
  *
- * Copyright (C) 2005, 2011 Red Hat, Inc.
+ * Copyright (C) 2005, 2011-2012 Red Hat, Inc.
  *
  * Daniel Veillard <veillard redhat com>
  */
@@ -163,7 +163,6 @@ PyObject * libvirt_ulonglongWrap(unsigned long long val);
 PyObject * libvirt_charPtrWrap(char *str);
 PyObject * libvirt_charPtrSizeWrap(char *str, Py_ssize_t size);
 PyObject * libvirt_constcharPtrWrap(const char *str);
-PyObject * libvirt_charPtrConstWrap(const char *str);
 PyObject * libvirt_virConnectPtrWrap(virConnectPtr node);
 PyObject * libvirt_virDomainPtrWrap(virDomainPtr node);
 PyObject * libvirt_virNetworkPtrWrap(virNetworkPtr node);
-- 
1.7.7.6


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