index entry: avoid extra copy
This commit is contained in:
parent
824ac672c1
commit
dcd5acc34e
12
src/index.c
12
src/index.c
@ -650,18 +650,12 @@ IndexEntry_path__get__(IndexEntry *self)
|
|||||||
int
|
int
|
||||||
IndexEntry_path__set__(IndexEntry *self, PyObject *py_path)
|
IndexEntry_path__set__(IndexEntry *self, PyObject *py_path)
|
||||||
{
|
{
|
||||||
char *c_inner, *c_path;
|
char *c_path;
|
||||||
|
|
||||||
c_inner = py_str_to_c_str(py_path, NULL);
|
c_path = py_str_to_c_str(py_path, NULL);
|
||||||
if (!c_inner)
|
if (!c_path)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
c_path = strdup(c_inner);
|
|
||||||
if (!c_path) {
|
|
||||||
PyErr_NoMemory();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(self->entry.path);
|
free(self->entry.path);
|
||||||
self->entry.path = c_path;
|
self->entry.path = c_path;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user