Skip to content

Commit dcd5acc

Browse files
committed
index entry: avoid extra copy
1 parent 824ac67 commit dcd5acc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/index.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -650,18 +650,12 @@ IndexEntry_path__get__(IndexEntry *self)
650650
int
651651
IndexEntry_path__set__(IndexEntry *self, PyObject *py_path)
652652
{
653-
char *c_inner, *c_path;
653+
char *c_path;
654654

655-
c_inner = py_str_to_c_str(py_path, NULL);
656-
if (!c_inner)
655+
c_path = py_str_to_c_str(py_path, NULL);
656+
if (!c_path)
657657
return -1;
658658

659-
c_path = strdup(c_inner);
660-
if (!c_path) {
661-
PyErr_NoMemory();
662-
return -1;
663-
}
664-
665659
free(self->entry.path);
666660
self->entry.path = c_path;
667661

0 commit comments

Comments
 (0)