From 1f1133b8714d1f6e5da656eddb3c6ff62f5e3570 Mon Sep 17 00:00:00 2001 From: Jason Erickson Date: Sun, 16 May 2010 15:20:22 -0600 Subject: [PATCH] Micrsoft Visual C Compile Fix Moved the declarations of variables/pointers to the beginning of the block, where MSVC wants them. --- psycopg/adapter_datetime.c | 5 +++-- psycopg/connection_int.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 8d5aa3dd..5f7327bb 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -56,6 +56,8 @@ extern HIDDEN PyObject *pyPsycopgTzLOCAL; static PyObject * pydatetime_str(pydatetimeObject *self) { + PyObject *res = NULL; + PyObject *iso; if (self->type <= PSYCO_DATETIME_TIMESTAMP) { PyObject *tz; @@ -76,8 +78,7 @@ pydatetime_str(pydatetimeObject *self) break; } - PyObject *res = NULL; - PyObject *iso = PyObject_CallMethod(self->wrapped, "isoformat", NULL); + iso = PyObject_CallMethod(self->wrapped, "isoformat", NULL); if (iso) { res = PyString_FromFormat(fmt, PyString_AsString(iso)); Py_DECREF(iso); diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 31a68d54..902fdbb9 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -256,6 +256,7 @@ int conn_setup(connectionObject *self, PGconn *pgconn) { PGresult *pgres; + int green; self->equote = conn_get_standard_conforming_strings(pgconn); self->server_version = conn_get_server_version(pgconn); @@ -265,7 +266,7 @@ conn_setup(connectionObject *self, PGconn *pgconn) pthread_mutex_lock(&self->lock); Py_BLOCK_THREADS; - int green = psyco_green(); + green = psyco_green(); if (green && (pq_set_non_blocking(self, 1, 1) != 0)) { return -1;