summaryrefslogtreecommitdiffstats
path: root/typewrappers.c
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2011-06-14 16:07:43 -0400
committerCole Robinson <crobinso@redhat.com>2011-06-21 10:08:47 -0400
commitfa47dad041bf9878702724dba9d0ca4152fab928 (patch)
tree13b08cdead9ee6312e7116d0ea1f3f5f578aee97 /typewrappers.c
parent8f2990bffe64b6d9392abd60a2bdc6da3a9aeafd (diff)
downloadlibvirt-python-v6-fa47dad041bf9878702724dba9d0ca4152fab928.tar.gz
libvirt-python-v6-fa47dad041bf9878702724dba9d0ca4152fab928.tar.xz
libvirt-python-v6-fa47dad041bf9878702724dba9d0ca4152fab928.zip
python: Implement virStreamSend/Recv
The return values for the python version are different that the C version of virStreamSend: on success we return a string, an error raises an exception, and if the stream would block we return int(-2). We need to do this since strings aren't passed by reference in python.
Diffstat (limited to 'typewrappers.c')
-rw-r--r--typewrappers.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/typewrappers.c b/typewrappers.c
index e39d3cd..b5758b4 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -77,6 +77,20 @@ libvirt_ulonglongWrap(unsigned long long val)
}
PyObject *
+libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
+{
+ PyObject *ret;
+
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret = PyString_FromStringAndSize(str, size);
+ free(str);
+ return (ret);
+}
+
+PyObject *
libvirt_charPtrWrap(char *str)
{
PyObject *ret;