diff options
author | David Sommerseth <davids@redhat.com> | 2013-12-20 01:46:01 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2013-12-20 01:46:01 +0100 |
commit | d4bc3a50bb6124a0000879f27d43e9685934d682 (patch) | |
tree | 90bba459968245d81f7b76a67d8f6e6b20d1b889 /python-ethtool/etherinfo.c | |
parent | 50704634080bb653e899ff4a1d730968fb731398 (diff) | |
download | python-ethtool-d4bc3a50bb6124a0000879f27d43e9685934d682.tar.gz python-ethtool-d4bc3a50bb6124a0000879f27d43e9685934d682.tar.xz python-ethtool-d4bc3a50bb6124a0000879f27d43e9685934d682.zip |
Make the device string a python object as well
This will simplify to "pythonize" struct etherinfo further.
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'python-ethtool/etherinfo.c')
-rw-r--r-- | python-ethtool/etherinfo.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c index 61fe037..88cefc8 100644 --- a/python-ethtool/etherinfo.c +++ b/python-ethtool/etherinfo.c @@ -52,8 +52,7 @@ void free_etherinfo(struct etherinfo *ptr) return; } - free(ptr->device); - + Py_XDECREF(ptr->device); Py_XDECREF(ptr->hwaddress); free(ptr); @@ -145,7 +144,7 @@ static int _set_device_index(struct etherinfo *ethinf) return 0; } - link = rtnl_link_get_by_name(link_cache, ethinf->device); + link = rtnl_link_get_by_name(link_cache, PyString_AsString(ethinf->device)); if( !link ) { nl_cache_free(link_cache); return 0; @@ -185,7 +184,7 @@ int get_etherinfo_link(etherinfo_py *self) if( !open_netlink(self) ) { PyErr_Format(PyExc_RuntimeError, "Could not open a NETLINK connection for %s", - ethinf->device); + PyString_AsString(ethinf->device)); return 0; } @@ -235,7 +234,7 @@ PyObject * get_etherinfo_address(etherinfo_py *self, nlQuery query) if( !open_netlink(self) ) { PyErr_Format(PyExc_RuntimeError, "Could not open a NETLINK connection for %s", - ethinf->device); + PyString_AsString(ethinf->device)); return NULL; } |