From ec00d3ceee4b89e47743479e0ede5222a5a496b9 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 29 Jun 2008 19:46:03 +0200 Subject: [PATCH] Some small fixes in get_all --- xattr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xattr.c b/xattr.c index 48a66a9..d2b4389 100644 --- a/xattr.c +++ b/xattr.c @@ -1,6 +1,10 @@ #include #include +/* the estimated (startup) attribute buffer size in + multi-operations */ +#define ESTIMATE_ATTR_SIZE 256 + typedef enum {T_FD, T_PATH, T_LINK} target_e; typedef struct { @@ -211,7 +215,7 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds) /* Create the list which will hold the result */ mylist = PyList_New(0); - nalloc = 256; + nalloc = ESTIMATE_ATTR_SIZE; if((buf_val = PyMem_Malloc(nalloc)) == NULL) { PyErr_NoMemory(); goto free_list; @@ -262,7 +266,6 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds) return mylist; exit_errno: PyErr_SetFromErrno(PyExc_IOError); - free_buf_val: PyMem_Free(buf_val); free_list: Py_DECREF(mylist); -- 2.39.5