From e409cb0905a799d6de9b91b82b0bb5648b12aaec Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 14 May 2014 17:24:35 +0200 Subject: Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY() Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between pyconfig.h and pymacros.h. --- Python/marshal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Python/marshal.c') diff --git a/Python/marshal.c b/Python/marshal.c index dc5411c1ff..ca64be3948 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -13,8 +13,6 @@ #include "code.h" #include "marshal.h" -#define ABS(x) ((x) < 0 ? -(x) : (x)) - /* High water mark to determine when the marshalled object is dangerously deep * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. @@ -192,7 +190,7 @@ w_PyLong(const PyLongObject *ob, char flag, WFILE *p) } /* set l to number of base PyLong_MARSHAL_BASE digits */ - n = ABS(Py_SIZE(ob)); + n = Py_ABS(Py_SIZE(ob)); l = (n-1) * PyLong_MARSHAL_RATIO; d = ob->ob_digit[n-1]; assert(d != 0); /* a PyLong is always normalized */ @@ -727,8 +725,8 @@ r_PyLong(RFILE *p) return NULL; } - size = 1 + (ABS(n) - 1) / PyLong_MARSHAL_RATIO; - shorts_in_top_digit = 1 + (ABS(n) - 1) % PyLong_MARSHAL_RATIO; + size = 1 + (Py_ABS(n) - 1) / PyLong_MARSHAL_RATIO; + shorts_in_top_digit = 1 + (Py_ABS(n) - 1) % PyLong_MARSHAL_RATIO; ob = _PyLong_New(size); if (ob == NULL) return NULL; -- cgit v1.2.1