[Python-checkins] cpython: Reuse Py_STRINGIFY() macro in sre_lib.h and dynload_win.c.

serhiy.storchaka python-checkins at python.org
Thu Nov 5 10:51:39 EST 2015


https://hg.python.org/cpython/rev/9135ff7255a1
changeset:   98970:9135ff7255a1
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Nov 05 17:43:42 2015 +0200
summary:
  Reuse Py_STRINGIFY() macro in sre_lib.h and dynload_win.c.

files:
  Modules/sre_lib.h    |  6 ++----
  Python/dynload_win.c |  6 ++----
  2 files changed, 4 insertions(+), 8 deletions(-)


diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h
--- a/Modules/sre_lib.h
+++ b/Modules/sre_lib.h
@@ -367,14 +367,12 @@
 #define RETURN_ON_FAILURE(i) \
     do { RETURN_ON_ERROR(i); if (i == 0) RETURN_FAILURE; } while (0)
 
-#define SFY(x) #x
-
 #define DATA_STACK_ALLOC(state, type, ptr) \
 do { \
     alloc_pos = state->data_stack_base; \
     TRACE(("allocating %s in %" PY_FORMAT_SIZE_T "d " \
            "(%" PY_FORMAT_SIZE_T "d)\n", \
-           SFY(type), alloc_pos, sizeof(type))); \
+           Py_STRINGIFY(type), alloc_pos, sizeof(type))); \
     if (sizeof(type) > state->data_stack_size - alloc_pos) { \
         int j = data_stack_grow(state, sizeof(type)); \
         if (j < 0) return j; \
@@ -387,7 +385,7 @@
 
 #define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \
 do { \
-    TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", SFY(type), pos)); \
+    TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", Py_STRINGIFY(type), pos)); \
     ptr = (type*)(state->data_stack+pos); \
 } while (0)
 
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -24,12 +24,10 @@
 #define PYD_DEBUG_SUFFIX ""
 #endif
 
-#define STRINGIZE2(x) #x
-#define STRINGIZE(x) STRINGIZE2(x)
 #ifdef PYD_PLATFORM_TAG
-#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
+#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
 #else
-#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) ".pyd"
+#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd"
 #endif
 
 #define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list