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_obj.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_obj.c')
-rw-r--r-- | python-ethtool/etherinfo_obj.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python-ethtool/etherinfo_obj.c b/python-ethtool/etherinfo_obj.c index 7885a48..07e4b58 100644 --- a/python-ethtool/etherinfo_obj.c +++ b/python-ethtool/etherinfo_obj.c @@ -138,7 +138,8 @@ PyObject *_ethtool_etherinfo_getter(etherinfo_py *self, PyObject *attr_o) if( strcmp(attr, "device") == 0 ) { if( self->ethinfo->device ) { - return PyString_FromString(self->ethinfo->device); + Py_INCREF(self->ethinfo->device); + return self->ethinfo->device; } else { return Py_INCREF(Py_None), Py_None; } @@ -215,7 +216,10 @@ PyObject *_ethtool_etherinfo_str(etherinfo_py *self) get_etherinfo_link(self); - ret = PyString_FromFormat("Device %s:\n", self->ethinfo->device); + ret = PyString_FromFormat("Device "); + PyString_Concat(&ret, self->ethinfo->device); + PyString_ConcatAndDel(&ret, PyString_FromString(":\n")); + if( self->ethinfo->hwaddress ) { PyString_ConcatAndDel(&ret, PyString_FromString("\tMAC address: ")); PyString_Concat(&ret, self->ethinfo->hwaddress); |