summaryrefslogtreecommitdiff
path: root/source3/python/py_tdbpack.c
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-11-12 22:07:11 +0000
committerMartin Pool <mbp@samba.org>2002-11-12 22:07:11 +0000
commit5d3bc0bc838f1b25b2edfb14af74a091c4d41c08 (patch)
treef29bee90f763c5cb8e4fafbe99a3764026cde8ff /source3/python/py_tdbpack.c
parent664a5061e020c5c83deb32c63a1a4bd298beffd4 (diff)
downloadsamba-5d3bc0bc838f1b25b2edfb14af74a091c4d41c08.tar.gz
samba-5d3bc0bc838f1b25b2edfb14af74a091c4d41c08.tar.bz2
samba-5d3bc0bc838f1b25b2edfb14af74a091c4d41c08.zip
Just reorder functions to put related ones together
(This used to be commit 7863c948b73785e49d04227e87d8b4b47fd61f58)
Diffstat (limited to 'source3/python/py_tdbpack.c')
-rw-r--r--source3/python/py_tdbpack.c78
1 files changed, 38 insertions, 40 deletions
diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c
index 3f7d21604b..ba22fc3a63 100644
--- a/source3/python/py_tdbpack.c
+++ b/source3/python/py_tdbpack.c
@@ -378,6 +378,44 @@ pytdbpack_buffer(PyObject *val_iter, PyObject *packed_list)
}
+static PyObject *pytdbpack_bad_type(char ch,
+ const char *expected,
+ PyObject *val_obj)
+{
+ PyObject *r = PyObject_Repr(val_obj);
+ if (!r)
+ return NULL;
+ PyErr_Format(PyExc_TypeError,
+ "tdbpack: format '%c' requires %s, not %s",
+ ch, expected, PyString_AS_STRING(r));
+ Py_DECREF(r);
+ return val_obj;
+}
+
+
+/*
+ XXX: glib and Samba have quicker macro for doing the endianness conversions,
+ but I don't know of one in plain libc, and it's probably not a big deal. I
+ realize this is kind of dumb because we'll almost always be on x86, but
+ being safe is important.
+*/
+static void pack_le_uint32(unsigned long val_long, unsigned char *pbuf)
+{
+ pbuf[0] = val_long & 0xff;
+ pbuf[1] = (val_long >> 8) & 0xff;
+ pbuf[2] = (val_long >> 16) & 0xff;
+ pbuf[3] = (val_long >> 24) & 0xff;
+}
+
+
+static void pack_bytes(long len, const char *from,
+ unsigned char **pbuf)
+{
+ memcpy(*pbuf, from, len);
+ (*pbuf) += len;
+}
+
+
static PyObject *
pytdbpack_unpack(PyObject *self,
@@ -448,46 +486,6 @@ pytdbpack_unpack(PyObject *self,
}
-
-
-static PyObject *pytdbpack_bad_type(char ch,
- const char *expected,
- PyObject *val_obj)
-{
- PyObject *r = PyObject_Repr(val_obj);
- if (!r)
- return NULL;
- PyErr_Format(PyExc_TypeError,
- "tdbpack: format '%c' requires %s, not %s",
- ch, expected, PyString_AS_STRING(r));
- Py_DECREF(r);
- return val_obj;
-}
-
-
-/*
- XXX: glib and Samba have quicker macro for doing the endianness conversions,
- but I don't know of one in plain libc, and it's probably not a big deal. I
- realize this is kind of dumb because we'll almost always be on x86, but
- being safe is important.
-*/
-static void pack_le_uint32(unsigned long val_long, unsigned char *pbuf)
-{
- pbuf[0] = val_long & 0xff;
- pbuf[1] = (val_long >> 8) & 0xff;
- pbuf[2] = (val_long >> 16) & 0xff;
- pbuf[3] = (val_long >> 24) & 0xff;
-}
-
-
-static void pack_bytes(long len, const char *from,
- unsigned char **pbuf)
-{
- memcpy(*pbuf, from, len);
- (*pbuf) += len;
-}
-
-
static void
unpack_err_too_short(void)
{