gh-108765: pystrhex: Replace stdlib.h abs() with Py_ABS() (#108830)

This commit is contained in:
Victor Stinner 2023-09-02 23:15:54 +02:00 committed by GitHub
parent 6fafa6b919
commit a52213bf83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -3,7 +3,6 @@
#include "Python.h" #include "Python.h"
#include "pycore_strhex.h" // _Py_strhex_with_sep() #include "pycore_strhex.h" // _Py_strhex_with_sep()
#include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency() #include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency()
#include <stdlib.h> // abs()
static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen, static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
PyObject* sep, int bytes_per_sep_group, PyObject* sep, int bytes_per_sep_group,
@ -44,7 +43,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
bytes_per_sep_group = 0; bytes_per_sep_group = 0;
} }
unsigned int abs_bytes_per_sep = abs(bytes_per_sep_group); unsigned int abs_bytes_per_sep = Py_ABS(bytes_per_sep_group);
Py_ssize_t resultlen = 0; Py_ssize_t resultlen = 0;
if (bytes_per_sep_group && arglen > 0) { if (bytes_per_sep_group && arglen > 0) {
/* How many sep characters we'll be inserting. */ /* How many sep characters we'll be inserting. */