diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-12-01 00:19:37 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-12-01 01:48:25 +0100 |
commit | efd8fc0672ee48a40f5e302353ca63590a6d7b45 (patch) | |
tree | 146ba9025de0afe9f28fc70b367316a2b4d48224 /lib/talloc | |
parent | b8dc3c8a83af38adf0ee5874331b04692f2dec8d (diff) | |
download | samba-efd8fc0672ee48a40f5e302353ca63590a6d7b45.tar.gz samba-efd8fc0672ee48a40f5e302353ca63590a6d7b45.tar.bz2 samba-efd8fc0672ee48a40f5e302353ca63590a6d7b45.zip |
pytalloc: Make py_talloc_default_cmp private.
Diffstat (limited to 'lib/talloc')
-rw-r--r-- | lib/talloc/pytalloc.c | 15 | ||||
-rw-r--r-- | lib/talloc/pytalloc.h | 1 | ||||
-rw-r--r-- | lib/talloc/pytalloc_util.c | 13 |
3 files changed, 15 insertions, 14 deletions
diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c index c45810f44d..262ba493c5 100644 --- a/lib/talloc/pytalloc.c +++ b/lib/talloc/pytalloc.c @@ -97,6 +97,21 @@ static void py_talloc_dealloc(PyObject* self) self->ob_type->tp_free(self); } +/** + * Default (but only slightly more useful than the default) implementation of cmp. + */ +static int py_talloc_default_cmp(PyObject *_obj1, PyObject *_obj2) +{ + py_talloc_Object *obj1 = (py_talloc_Object *)_obj1, + *obj2 = (py_talloc_Object *)_obj2; + if (obj1->ob_type != obj2->ob_type) + return (obj1->ob_type - obj2->ob_type); + + return ((char *)py_talloc_get_ptr(obj1) - (char *)py_talloc_get_ptr(obj2)); +} + + + static PyTypeObject TallocObject_Type = { .tp_name = "talloc.Object", .tp_basicsize = sizeof(py_talloc_Object), diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h index affb77ce9a..bfd9c2e017 100644 --- a/lib/talloc/pytalloc.h +++ b/lib/talloc/pytalloc.h @@ -52,6 +52,5 @@ PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, voi PyObject *PyCObject_FromTallocPtr(void *); PyObject *PyString_FromString_check_null(const char *ptr); -int py_talloc_default_cmp(PyObject *obj1, PyObject *obj2); #endif /* _PY_TALLOC_H_ */ diff --git a/lib/talloc/pytalloc_util.c b/lib/talloc/pytalloc_util.c index 4ed2f16b24..d082ee89e7 100644 --- a/lib/talloc/pytalloc_util.c +++ b/lib/talloc/pytalloc_util.c @@ -97,19 +97,6 @@ PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, voi return (PyObject *)ret; } -/** - * Default (but only slightly more useful than the default) implementation of cmp. - */ -int py_talloc_default_cmp(PyObject *_obj1, PyObject *_obj2) -{ - py_talloc_Object *obj1 = (py_talloc_Object *)_obj1, - *obj2 = (py_talloc_Object *)_obj2; - if (obj1->ob_type != obj2->ob_type) - return (obj1->ob_type - obj2->ob_type); - - return ((char *)py_talloc_get_ptr(obj1) - (char *)py_talloc_get_ptr(obj2)); -} - static void py_cobject_talloc_free(void *ptr) { talloc_free(ptr); |