mercurial/cext/manifest.c
branchstable
changeset 39424 094d1f42c484
parent 39423 ca77788c81bc
child 39939 e85462d48cb3
equal deleted inserted replaced
39423:ca77788c81bc 39424:094d1f42c484
   729 	for (i = 0; i < self->numlines; i++) {
   729 	for (i = 0; i < self->numlines; i++) {
   730 		PyObject *arglist = NULL, *result = NULL;
   730 		PyObject *arglist = NULL, *result = NULL;
   731 		arglist = Py_BuildValue(PY23("(s)", "(y)"),
   731 		arglist = Py_BuildValue(PY23("(s)", "(y)"),
   732 					self->lines[i].start);
   732 					self->lines[i].start);
   733 		if (!arglist) {
   733 		if (!arglist) {
   734 			return NULL;
   734 			goto bail;
   735 		}
   735 		}
   736 		result = PyObject_CallObject(matchfn, arglist);
   736 		result = PyObject_CallObject(matchfn, arglist);
   737 		Py_DECREF(arglist);
   737 		Py_DECREF(arglist);
   738 		/* if the callback raised an exception, just let it
   738 		/* if the callback raised an exception, just let it
   739 		 * through and give up */
   739 		 * through and give up */
   740 		if (!result) {
   740 		if (!result) {
   741 			free(copy->lines);
   741 			goto bail;
   742 			Py_DECREF(copy->pydata);
       
   743 			return NULL;
       
   744 		}
   742 		}
   745 		if (PyObject_IsTrue(result)) {
   743 		if (PyObject_IsTrue(result)) {
   746 			assert(!(self->lines[i].from_malloc));
   744 			assert(!(self->lines[i].from_malloc));
   747 			copy->lines[copy->numlines++] = self->lines[i];
   745 			copy->lines[copy->numlines++] = self->lines[i];
   748 		}
   746 		}
   750 	}
   748 	}
   751 	copy->livelines = copy->numlines;
   749 	copy->livelines = copy->numlines;
   752 	return copy;
   750 	return copy;
   753 nomem:
   751 nomem:
   754 	PyErr_NoMemory();
   752 	PyErr_NoMemory();
       
   753 bail:
   755 	Py_XDECREF(copy);
   754 	Py_XDECREF(copy);
   756 	return NULL;
   755 	return NULL;
   757 }
   756 }
   758 
   757 
   759 static PyObject *lazymanifest_diff(lazymanifest *self, PyObject *args)
   758 static PyObject *lazymanifest_diff(lazymanifest *self, PyObject *args)