comparison mercurial/cext/revlog.c @ 44212:3122058df7a5 stable

cext: move variable declaration to the top of the block for C89 support Not sure if we still care about C89 in general, but MSVC requires this style too. Differential Revision: https://phab.mercurial-scm.org/D8304
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 20 Mar 2020 10:04:13 -0400
parents 864e9534d3d4
children 090a1a78be4a
comparison
equal deleted inserted replaced
44211:bc9a9016467d 44212:3122058df7a5
151 */ 151 */
152 static const char *index_deref(indexObject *self, Py_ssize_t pos) 152 static const char *index_deref(indexObject *self, Py_ssize_t pos)
153 { 153 {
154 if (self->inlined && pos > 0) { 154 if (self->inlined && pos > 0) {
155 if (self->offsets == NULL) { 155 if (self->offsets == NULL) {
156 Py_ssize_t ret;
156 self->offsets = PyMem_Malloc(self->raw_length * 157 self->offsets = PyMem_Malloc(self->raw_length *
157 sizeof(*self->offsets)); 158 sizeof(*self->offsets));
158 if (self->offsets == NULL) 159 if (self->offsets == NULL)
159 return (const char *)PyErr_NoMemory(); 160 return (const char *)PyErr_NoMemory();
160 Py_ssize_t ret = inline_scan(self, self->offsets); 161 ret = inline_scan(self, self->offsets);
161 if (ret == -1) { 162 if (ret == -1) {
162 return NULL; 163 return NULL;
163 }; 164 };
164 } 165 }
165 return self->offsets[pos]; 166 return self->offsets[pos];