diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index a78a005e..8e9d7b05 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -35,6 +35,7 @@ static void conn_notice_callback(void *args, const char *message) { + struct connectionObject_notice *notice; connectionObject *self = (connectionObject *)args; Dprintf("conn_notice_callback: %s", message); @@ -52,8 +53,7 @@ conn_notice_callback(void *args, const char *message) if (self->protocol < 3 && strncmp(message, "ERROR", 5) == 0) pq_set_critical(self, message); else { - struct connectionObject_notice *notice = - (struct connectionObject_notice *) + notice = (struct connectionObject_notice *) malloc(sizeof(struct connectionObject_notice)); notice->message = strdup(message); notice->next = self->notice_pending; @@ -64,10 +64,11 @@ conn_notice_callback(void *args, const char *message) void conn_notice_process(connectionObject *self) { + struct connectionObject_notice *notice; Py_BEGIN_ALLOW_THREADS; pthread_mutex_lock(&self->lock); - struct connectionObject_notice *notice = self->notice_pending; + notice = self->notice_pending; while (notice != NULL) { Py_BLOCK_THREADS; @@ -97,10 +98,11 @@ conn_notice_process(connectionObject *self) void conn_notice_clean(connectionObject *self) { + struct connectionObject_notice *tmp, *notice; Py_BEGIN_ALLOW_THREADS; pthread_mutex_lock(&self->lock); - struct connectionObject_notice *tmp, *notice = self->notice_pending; + notice = self->notice_pending; while (notice != NULL) { tmp = notice; diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index b79446d8..46c8dd4a 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -684,7 +684,7 @@ static PyObject * _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res, int row, int n, int istuple) { - int i, len; + int i, len, err; const char *str; PyObject *val; @@ -713,7 +713,7 @@ _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res, PyTuple_SET_ITEM(res, i, val); } else { - int err = PySequence_SetItem(res, i, val); + err = PySequence_SetItem(res, i, val); Py_DECREF(val); if (err == -1) { Py_DECREF(res);