Skip to content

Commit

Permalink
index entry: avoid extra copy
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmn committed Feb 4, 2014
1 parent 824ac67 commit dcd5acc
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,18 +650,12 @@ IndexEntry_path__get__(IndexEntry *self)
int
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);
if (!c_inner)
c_path = py_str_to_c_str(py_path, NULL);
if (!c_path)
return -1;

c_path = strdup(c_inner);
if (!c_path) {
PyErr_NoMemory();
return -1;
}

free(self->entry.path);
self->entry.path = c_path;

Expand Down

0 comments on commit dcd5acc

Please sign in to comment.