diff options
| author | John Ehresman <jpe@wingware.com> | 2010-04-15 17:53:45 -0400 |
|---|---|---|
| committer | David Malcolm <dmalcolm@redhat.com> | 2010-04-16 13:02:42 -0400 |
| commit | 626f66f7dac93e53b8cab75cc63b5283c628c490 (patch) | |
| tree | 28cfc7dafdb7dacc8fa759c72bf741f23ac1afa0 /glib | |
| parent | 8c0e1634ff4546a94101cd3965e94c81d04649c2 (diff) | |
Use bytes rather than bytearray and use PYGLIB_ macro prefix
Diffstat (limited to 'glib')
| -rw-r--r-- | glib/pygiochannel.c | 14 | ||||
| -rw-r--r-- | glib/pyglib-python-compat.h | 20 |
2 files changed, 17 insertions, 17 deletions
diff --git a/glib/pygiochannel.c b/glib/pygiochannel.c index d01dd40..544d3dd 100644 --- a/glib/pygiochannel.c +++ b/glib/pygiochannel.c @@ -204,16 +204,16 @@ py_io_channel_read_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) } if ( ret_obj == NULL ) { - ret_obj = _PyByteArray_FromStringAndSize((char *)NULL, buf_size); + ret_obj = PYGLIB_PyBytes_FromStringAndSize((char *)NULL, buf_size); if (ret_obj == NULL) goto failure; } - else if (buf_size + total_read > _PyByteArray_Size(ret_obj)) { - if (_PyByteArray_Resize(&ret_obj, buf_size + total_read) == -1) + else if (buf_size + total_read > PYGLIB_PyBytes_Size(ret_obj)) { + if (PYGLIB_PyBytes_Resize(&ret_obj, buf_size + total_read) == -1) goto failure; } - buf = _PyByteArray_AsString(ret_obj) + total_read; + buf = PYGLIB_PyBytes_AsString(ret_obj) + total_read; pyglib_unblock_threads(); status = g_io_channel_read_chars(self->channel, buf, buf_size, @@ -225,8 +225,8 @@ py_io_channel_read_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) total_read += single_read; } - if ( total_read != _PyByteArray_Size(ret_obj) ) { - if (_PyByteArray_Resize(&ret_obj, total_read) == -1) + if ( total_read != PYGLIB_PyBytes_Size(ret_obj) ) { + if (PYGLIB_PyBytes_Resize(&ret_obj, total_read) == -1) goto failure; } @@ -237,7 +237,7 @@ py_io_channel_read_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) { PyObject *unicode_obj; - unicode_obj = PyUnicode_FromString(PyByteArray_AS_STRING(ret_obj)); + unicode_obj = PyUnicode_FromString(PyBytes_AS_STRING(ret_obj)); if (unicode_obj == NULL) goto failure; Py_DECREF(ret_obj); diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h index a422893..bea7d6b 100644 --- a/glib/pyglib-python-compat.h +++ b/glib/pyglib-python-compat.h @@ -95,11 +95,11 @@ static int _pyglib_init_##modname(PyObject *module) #define _PyUnicode_GET_SIZE PyString_GET_SIZE #define _PyUnicode_Type PyString_Type -#define _PyByteArray_FromStringAndSize PyString_FromStringAndSize -#define _PyByteArray_Resize _PyString_Resize -#define _PyByteArray_AsString PyString_AsString -#define _PyByteArray_Size PyString_Size -#define _PyByteArray_Check PyString_Check +#define PYGLIB_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PYGLIB_PyBytes_Resize _PyString_Resize +#define PYGLIB_PyBytes_AsString PyString_AsString +#define PYGLIB_PyBytes_Size PyString_Size +#define PYGLIB_PyBytes_Check PyString_Check #define _PyLong_Check PyInt_Check #define _PyLong_FromLong PyInt_FromLong @@ -190,11 +190,11 @@ PyTypeObject symbol = { \ #define _PyLongObject PyLongObject #define _PyLong_Type PyLong_Type -#define _PyByteArray_FromStringAndSize PyByteArray_FromStringAndSize -#define _PyByteArray_Resize(o, len) PyByteArray_Resize(*o, len) -#define _PyByteArray_AsString PyByteArray_AsString -#define _PyByteArray_Size PyByteArray_Size -#define _PyByteArray_Check PyByteArray_Check +#define PYGLIB_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define PYGLIB_PyBytes_Resize(o, len) _PyBytes_Resize(o, len) +#define PYGLIB_PyBytes_AsString PyBytes_AsString +#define PYGLIB_PyBytes_Size PyBytes_Size +#define PYGLIB_PyBytes_Check PyBytes_Check #endif |
