From eeb51a99c5a59534deae3f5f50ef80de270c505b Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Mon, 4 May 2009 00:48:41 +0000 Subject: [PATCH] cleanup applied patch to match style that is already in py3k branch. --- Modules/_hashopenssl.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 8dbaa208e49..ba18aa27ede 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -20,18 +20,15 @@ #ifdef WITH_THREAD #include "pythread.h" #define ENTER_HASHLIB(obj) \ - if ((obj)->lock) \ - { \ - if (!PyThread_acquire_lock((obj)->lock, 0)) \ - { \ + if ((obj)->lock) { \ + if (!PyThread_acquire_lock((obj)->lock, 0)) { \ Py_BEGIN_ALLOW_THREADS \ PyThread_acquire_lock((obj)->lock, 1); \ Py_END_ALLOW_THREADS \ } \ } #define LEAVE_HASHLIB(obj) \ - if ((obj)->lock) \ - { \ + if ((obj)->lock) { \ PyThread_release_lock((obj)->lock); \ } #else @@ -230,14 +227,12 @@ EVP_update(EVPobject *self, PyObject *args) GET_BUFFER_VIEW_OR_ERROUT(obj, &view, NULL); #ifdef WITH_THREAD - if (self->lock == NULL && view.len >= HASHLIB_GIL_MINSIZE) - { + if (self->lock == NULL && view.len >= HASHLIB_GIL_MINSIZE) { self->lock = PyThread_allocate_lock(); /* fail? lock = NULL and we fail over to non-threaded code. */ } - if (self->lock != NULL) - { + if (self->lock != NULL) { Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(self->lock, 1); EVP_hash(self, view.buf, view.len); @@ -352,14 +347,13 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds) Py_INCREF(self->name); if (data_obj) { - if (view.len >= HASHLIB_GIL_MINSIZE) - { + if (view.len >= HASHLIB_GIL_MINSIZE) { Py_BEGIN_ALLOW_THREADS EVP_hash(self, view.buf, view.len); Py_END_ALLOW_THREADS } else { EVP_hash(self, view.buf, view.len); - } + } PyBuffer_Release(&view); } @@ -450,8 +444,7 @@ EVPnew(PyObject *name_obj, } if (cp && len) { - if (len >= HASHLIB_GIL_MINSIZE) - { + if (len >= HASHLIB_GIL_MINSIZE) { Py_BEGIN_ALLOW_THREADS EVP_hash(self, cp, len); Py_END_ALLOW_THREADS