Skip to content

Commit 8706fce

Browse files
committed
Address code review
1 parent 8f77e0d commit 8706fce

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Include/internal/pycore_mmap.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ extern "C" {
1616
# include <sys/prctl.h>
1717
#endif
1818

19-
static inline int
20-
_PyAnnotateMemoryMap(void *addr, size_t size, const char *name)
21-
{
2219
#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
23-
if (_Py_GetConfig()->dev_mode) {
24-
assert(strlen(name) < 80);
25-
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
26-
// Ignore errno from prctl
27-
// See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746
28-
errno = 0;
29-
}
20+
# define _PyAnnotateMemoryMap(addr, size, name) \
21+
do { \
22+
if (_Py_GetConfig()->dev_mode) { \
23+
assert(strlen(name) < 80); \
24+
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)(addr), (size), (name)); \
25+
/* Ignore errno from prctl */ \
26+
/* See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746 */ \
27+
errno = 0; \
28+
} \
29+
} while (0)
30+
#else
31+
# define _PyAnnotateMemoryMap(addr, size, name) ((void)0)
3032
#endif
31-
return 0;
32-
}
3333

3434
#ifdef __cplusplus
3535
}

0 commit comments

Comments
 (0)