diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-10-29 10:10:17 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-10-29 10:10:17 +0200 |
commit | cebb292fd362475929fe35b74933140389c7eefb (patch) | |
tree | 38cd7fa64ed062069af694f59ba5ef5d06a12bc3 /python | |
parent | 58ead27b5e722d4d5fd195782d3bce348cea9a3e (diff) | |
download | librpm-tizen-cebb292fd362475929fe35b74933140389c7eefb.tar.gz librpm-tizen-cebb292fd362475929fe35b74933140389c7eefb.tar.bz2 librpm-tizen-cebb292fd362475929fe35b74933140389c7eefb.zip |
Avoid need for header_internal.h
- headerCopyLoad() achieves the same thing..
Diffstat (limited to 'python')
-rw-r--r-- | python/header-py.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/python/header-py.c b/python/header-py.c index f42d69238..e4a216d40 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -8,7 +8,6 @@ #include "legacy.h" #include "misc.h" -#include "header_internal.h" #include "rpmts.h" /* XXX rpmtsCreate/rpmtsFree */ @@ -146,12 +145,6 @@ struct hdrObject_s { unsigned short * modes; } ; -static inline Header headerAllocated(Header h) -{ - h->flags |= HEADERFLAG_ALLOCATED; - return 0; -} - /** \ingroup py_c */ static PyObject * hdrKeyList(hdrObject * s) @@ -679,20 +672,16 @@ PyObject * hdrLoad(PyObject * self, PyObject * args, PyObject * kwds) if (!PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwlist, &obj, &len)) return NULL; - /* malloc is needed to avoid surprises from data swab in headerLoad(). */ - copy = malloc(len); - if (copy == NULL) { - PyErr_SetString(pyrpmError, "out of memory"); - return NULL; - } - memcpy (copy, obj, len); - - h = headerLoad(copy); + /* copy is needed to avoid surprises from data swab in headerLoad(). */ + h = headerCopyLoad(obj); if (!h) { - PyErr_SetString(pyrpmError, "bad header"); + if (errno == ENOMEM) { + PyErr_SetString(pyrpmError, "out of memory"); + } else { + PyErr_SetString(pyrpmError, "bad header"); + } return NULL; } - headerAllocated(h); compressFilelist (h); providePackageNVR (h); |