Show More
@@ -8,6 +8,7 b'' | |||
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include <Python.h> |
|
11 | #include <assert.h> | |
|
11 | 12 | #include <ctype.h> |
|
12 | 13 | #include <stddef.h> |
|
13 | 14 | #include <string.h> |
@@ -816,6 +817,11 b' bail:' | |||
|
816 | 817 | return NULL; |
|
817 | 818 | } |
|
818 | 819 | |
|
820 | /** | |
|
821 | * Obtain the base revision index entry. | |
|
822 | * | |
|
823 | * Callers must ensure that rev >= 0 or illegal memory access may occur. | |
|
824 | */ | |
|
819 | 825 | static inline int index_baserev(indexObject *self, int rev) |
|
820 | 826 | { |
|
821 | 827 | const char *data; |
@@ -841,7 +847,7 b' static PyObject *index_deltachain(indexO' | |||
|
841 | 847 | PyObject *stoparg; |
|
842 | 848 | int stoprev, iterrev, baserev = -1; |
|
843 | 849 | int stopped; |
|
844 |
PyObject *chain |
|
|
850 | PyObject *chain = NULL, *result = NULL; | |
|
845 | 851 | const Py_ssize_t length = index_length(self); |
|
846 | 852 | |
|
847 | 853 | if (!PyArg_ParseTuple(args, "iOi", &rev, &stoparg, &generaldelta)) { |
@@ -876,15 +882,16 b' static PyObject *index_deltachain(indexO' | |||
|
876 | 882 | baserev = index_baserev(self, rev); |
|
877 | 883 | |
|
878 | 884 | /* This should never happen. */ |
|
879 |
if (baserev |
|
|
880 | PyErr_SetString(PyExc_IndexError, "unable to resolve data"); | |
|
885 | if (baserev <= -2) { | |
|
886 | /* Error should be set by index_deref() */ | |
|
887 | assert(PyErr_Occurred()); | |
|
881 | 888 | goto bail; |
|
882 | 889 | } |
|
883 | 890 | |
|
884 | 891 | iterrev = rev; |
|
885 | 892 | |
|
886 | 893 | while (iterrev != baserev && iterrev != stoprev) { |
|
887 | value = PyInt_FromLong(iterrev); | |
|
894 | PyObject *value = PyInt_FromLong(iterrev); | |
|
888 | 895 | if (value == NULL) { |
|
889 | 896 | goto bail; |
|
890 | 897 | } |
@@ -913,8 +920,9 b' static PyObject *index_deltachain(indexO' | |||
|
913 | 920 | baserev = index_baserev(self, iterrev); |
|
914 | 921 | |
|
915 | 922 | /* This should never happen. */ |
|
916 |
if (baserev |
|
|
917 | PyErr_SetString(PyExc_IndexError, "unable to resolve data"); | |
|
923 | if (baserev <= -2) { | |
|
924 | /* Error should be set by index_deref() */ | |
|
925 | assert(PyErr_Occurred()); | |
|
918 | 926 | goto bail; |
|
919 | 927 | } |
|
920 | 928 | } |
@@ -923,7 +931,7 b' static PyObject *index_deltachain(indexO' | |||
|
923 | 931 | stopped = 1; |
|
924 | 932 | } |
|
925 | 933 | else { |
|
926 | value = PyInt_FromLong(iterrev); | |
|
934 | PyObject *value = PyInt_FromLong(iterrev); | |
|
927 | 935 | if (value == NULL) { |
|
928 | 936 | goto bail; |
|
929 | 937 | } |
General Comments 0
You need to be logged in to leave comments.
Login now