From 30c8e4bd17bdc055bc5c3cda12fa0430b997a29b Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 14 Dec 2008 18:41:34 +0100 Subject: [PATCH] Add a new field to the target_t structure The patch extends the target_t structure with a new PyObject field and adds a cleanup function for it. This field is needed for properly handling unicode input arguments with Py3K. --- xattr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xattr.c b/xattr.c index c42fd60..177a4ac 100644 --- a/xattr.c +++ b/xattr.c @@ -53,8 +53,16 @@ typedef struct { const char *name; int fd; }; + PyObject *tmp; } target_t; +/* Cleans up a tgt structure */ +static void free_tgt(target_t *tgt) { + if (tgt->tmp != NULL) { + Py_DECREF(tgt->tmp); + } +} + /** Converts from a string, file or int argument to what we need. */ static int convertObj(PyObject *myobj, target_t *tgt, int nofollow) { int fd; -- 2.39.5