8000 `Modules/posixmodule.c`: protect macros expansion via `do { ... } whi… · python/cpython@1b65e98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b65e98

Browse files
committed
Modules/posixmodule.c: protect macros expansion via do { ... } while (0) constructions
1 parent e195b55 commit 1b65e98

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Modules/posixmodule.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,15 +6224,15 @@ os_uname_impl(PyObject *module)
62246224
if (value == NULL)
62256225
return NULL;
62266226

6227-
#define SET(i, field) \
6228-
{ \
6229-
PyObject *o = PyUnicode_DecodeFSDefault(field); \
6230-
if (!o) { \
6231-
Py_DECREF(value); \
6232-
return NULL; \
6233-
} \
6234-
PyStructSequence_SET_ITEM(value, i, o); \
6235-
} \
6227+
#define SET(INDEX, FIELD) \
6228+
do { \
6229+
PyObject *o = PyUnicode_DecodeFSDefault(FIELD); \
6230+
if (!o) { \
6231+
Py_DECREF(value); \
6232+
return NULL; \
6233+
} \
6234+
PyStructSequence_SET_ITEM(value, INDEX, o); \
6235+
} while (0)
62366236

62376237
SET(0, u.sysname);
62386238
SET(1, u.nodename);
@@ -10556,15 +10556,15 @@ build_times_result(PyObject *module, double user, double system,
1055610556
if (value == NULL)
1055710557
return NULL;
1055810558

10559-
#define SET(i, field) \
10560-
{ \
10561-
PyObject *o = PyFloat_FromDouble(field); \
10562-
if (!o) { \
10563-
Py_DECREF(value); \
10564-
return NULL; \
10565-
} \
10566-
PyStructSequence_SET_ITEM(value, i, o); \
10567-
} \
10559+
#define SET(INDEX, FIELD) \
10560+
do { \
10561+
PyObject *o = PyFloat_FromDouble(FIELD); \
10562+
if (!o) { \
10563+
Py_DECREF(value); \
10564+
return NULL; \
10565+
} \
10566+
PyStructSequence_SET_ITEM(value, INDEX, o); \
10567+
} while (0)
1056810568

1056910569
SET(0, user);
1057010570
SET(1, system);

0 commit comments

Comments
 (0)
0