equal
deleted
inserted
replaced
133 } |
133 } |
134 self->livelines = self->numlines; |
134 self->livelines = self->numlines; |
135 return 0; |
135 return 0; |
136 } |
136 } |
137 |
137 |
|
138 static void lazymanifest_init_early(lazymanifest *self) |
|
139 { |
|
140 self->pydata = NULL; |
|
141 self->lines = NULL; |
|
142 self->numlines = 0; |
|
143 self->maxlines = 0; |
|
144 } |
|
145 |
138 static int lazymanifest_init(lazymanifest *self, PyObject *args) |
146 static int lazymanifest_init(lazymanifest *self, PyObject *args) |
139 { |
147 { |
140 char *data; |
148 char *data; |
141 Py_ssize_t len; |
149 Py_ssize_t len; |
142 int err, ret; |
150 int err, ret; |
143 PyObject *pydata; |
151 PyObject *pydata; |
|
152 |
|
153 lazymanifest_init_early(self); |
144 if (!PyArg_ParseTuple(args, "S", &pydata)) { |
154 if (!PyArg_ParseTuple(args, "S", &pydata)) { |
145 return -1; |
155 return -1; |
146 } |
156 } |
147 err = PyBytes_AsStringAndSize(pydata, &data, &len); |
157 err = PyBytes_AsStringAndSize(pydata, &data, &len); |
148 |
158 |
666 } |
676 } |
667 copy = PyObject_New(lazymanifest, &lazymanifestType); |
677 copy = PyObject_New(lazymanifest, &lazymanifestType); |
668 if (!copy) { |
678 if (!copy) { |
669 goto nomem; |
679 goto nomem; |
670 } |
680 } |
|
681 lazymanifest_init_early(copy); |
671 copy->numlines = self->numlines; |
682 copy->numlines = self->numlines; |
672 copy->livelines = self->livelines; |
683 copy->livelines = self->livelines; |
673 copy->dirty = false; |
684 copy->dirty = false; |
674 copy->lines = malloc(self->maxlines *sizeof(line)); |
685 copy->lines = malloc(self->maxlines *sizeof(line)); |
675 if (!copy->lines) { |
686 if (!copy->lines) { |
703 } |
714 } |
704 copy = PyObject_New(lazymanifest, &lazymanifestType); |
715 copy = PyObject_New(lazymanifest, &lazymanifestType); |
705 if (!copy) { |
716 if (!copy) { |
706 goto nomem; |
717 goto nomem; |
707 } |
718 } |
|
719 lazymanifest_init_early(copy); |
708 copy->dirty = true; |
720 copy->dirty = true; |
709 copy->lines = malloc(self->maxlines * sizeof(line)); |
721 copy->lines = malloc(self->maxlines * sizeof(line)); |
710 if (!copy->lines) { |
722 if (!copy->lines) { |
711 goto nomem; |
723 goto nomem; |
712 } |
724 } |