[Python-checkins] cpython (3.4): improve style of the convert macro (#24655)

benjamin.peterson python-checkins at python.org
Sat Jul 18 20:01:22 CEST 2015


https://hg.python.org/cpython/rev/24cf6b4d72c2
changeset:   96940:24cf6b4d72c2
branch:      3.4
parent:      96928:5439faa1f604
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat Jul 18 10:59:13 2015 -0700
summary:
  improve style of the convert macro (#24655)

Patch by Brian Cain.

files:
  Modules/_ssl.c |  16 ++++++++--------
  1 files changed, 8 insertions(+), 8 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3372,20 +3372,20 @@
     PyObject *odir_env = NULL;
     PyObject *odir = NULL;
 
-#define convert(info, target) { \
+#define CONVERT(info, target) { \
         const char *tmp = (info); \
         target = NULL; \
         if (!tmp) { Py_INCREF(Py_None); target = Py_None; } \
         else if ((target = PyUnicode_DecodeFSDefault(tmp)) == NULL) { \
             target = PyBytes_FromString(tmp); } \
         if (!target) goto error; \
-    } while(0)
-
-    convert(X509_get_default_cert_file_env(), ofile_env);
-    convert(X509_get_default_cert_file(), ofile);
-    convert(X509_get_default_cert_dir_env(), odir_env);
-    convert(X509_get_default_cert_dir(), odir);
-#undef convert
+    } 
+
+    CONVERT(X509_get_default_cert_file_env(), ofile_env);
+    CONVERT(X509_get_default_cert_file(), ofile);
+    CONVERT(X509_get_default_cert_dir_env(), odir_env);
+    CONVERT(X509_get_default_cert_dir(), odir);
+#undef CONVERT
 
     return Py_BuildValue("NNNN", ofile_env, ofile, odir_env, odir);
 

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


More information about the Python-checkins mailing list