##// END OF EJS Templates
py3: convert revlog stats to a dict of (bytes, int) pairs...
Yuya Nishihara -
r40476:88702fd2 default
parent child Browse files
Show More
@@ -348,6 +348,7 b' static PyObject *index_append(indexObjec'
348 348 static PyObject *index_stats(indexObject *self)
349 349 {
350 350 PyObject *obj = PyDict_New();
351 PyObject *s = NULL;
351 352 PyObject *t = NULL;
352 353
353 354 if (obj == NULL)
@@ -355,22 +356,26 b' static PyObject *index_stats(indexObject'
355 356
356 357 #define istat(__n, __d) \
357 358 do { \
359 s = PyBytes_FromString(__d); \
358 360 t = PyInt_FromSsize_t(self->__n); \
359 if (!t) \
361 if (!s || !t) \
360 362 goto bail; \
361 if (PyDict_SetItemString(obj, __d, t) == -1) \
363 if (PyDict_SetItem(obj, s, t) == -1) \
362 364 goto bail; \
363 Py_DECREF(t); \
365 Py_CLEAR(s); \
366 Py_CLEAR(t); \
364 367 } while (0)
365 368
366 369 if (self->added) {
367 370 Py_ssize_t len = PyList_GET_SIZE(self->added);
371 s = PyBytes_FromString("index entries added");
368 372 t = PyInt_FromSsize_t(len);
369 if (!t)
373 if (!s || !t)
370 374 goto bail;
371 if (PyDict_SetItemString(obj, "index entries added", t) == -1)
375 if (PyDict_SetItem(obj, s, t) == -1)
372 376 goto bail;
373 Py_DECREF(t);
377 Py_CLEAR(s);
378 Py_CLEAR(t);
374 379 }
375 380
376 381 if (self->raw_length != self->length)
@@ -392,6 +397,7 b' static PyObject *index_stats(indexObject'
392 397
393 398 bail:
394 399 Py_XDECREF(obj);
400 Py_XDECREF(s);
395 401 Py_XDECREF(t);
396 402 return NULL;
397 403 }
General Comments 0
You need to be logged in to leave comments. Login now