]> arthur.ath.cx Git - bup.git/commitdiff
bup_limited_vint_pack: revert to malloc/free
authorRob Browning <rlb@defaultvalue.org>
Sun, 16 May 2021 16:14:41 +0000 (11:14 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 16 May 2021 16:23:40 +0000 (11:23 -0500)
Replace PyMem_RawMalloc and PyMemRawFree with malloc and free,
reverting my adjustment in 3b98812aa98a1590e2bebbc83c113c07e4c002bc.

Python 2 doesn't support them, and at least right now, regardless of
what the current python docs suggest, at the moment, they're just
trivial wrappers around malloc and free.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c

index 5ab9a9432f74c3a6be880df3bc8830b90c7dd5eb..81d66f01141151c4fc7ca34dc5357d016129f2fb 100644 (file)
@@ -2294,7 +2294,7 @@ static PyObject *bup_limited_vint_pack(PyObject *self, PyObject *args)
     // vint/vuint we can encode is anyway 10 bytes, so this gives us
     // some headroom for a few strings before we need to realloc ...
     bufsz = sz * 20;
-    buf = PyMem_RawMalloc(bufsz);
+    buf = malloc(bufsz);
     if (!buf)
         return PyErr_NoMemory();
 
@@ -2347,13 +2347,13 @@ static PyObject *bup_limited_vint_pack(PyObject *self, PyObject *args)
     }
 
     result = PyBytes_FromStringAndSize(buf, pos - buf);
-    PyMem_RawFree(buf);
+    free(buf);
     return result;
 
  overflow:
     PyErr_SetString(PyExc_OverflowError, "buffer (potentially) overflowed");
  error:
-    PyMem_RawFree(buf);
+    free(buf);
     return NULL;
 }