mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-03-03 15:45:46 +03:00
Moved declarations of varaibles/pointers to the beginning of functions
Moved the declarations of varaibles/pointers to the beginning of the functions, where MSVC requires them to be defined.
This commit is contained in:
parent
69224032ce
commit
0f00ee129d
|
@ -35,6 +35,7 @@
|
||||||
static void
|
static void
|
||||||
conn_notice_callback(void *args, const char *message)
|
conn_notice_callback(void *args, const char *message)
|
||||||
{
|
{
|
||||||
|
struct connectionObject_notice *notice;
|
||||||
connectionObject *self = (connectionObject *)args;
|
connectionObject *self = (connectionObject *)args;
|
||||||
|
|
||||||
Dprintf("conn_notice_callback: %s", message);
|
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)
|
if (self->protocol < 3 && strncmp(message, "ERROR", 5) == 0)
|
||||||
pq_set_critical(self, message);
|
pq_set_critical(self, message);
|
||||||
else {
|
else {
|
||||||
struct connectionObject_notice *notice =
|
notice = (struct connectionObject_notice *)
|
||||||
(struct connectionObject_notice *)
|
|
||||||
malloc(sizeof(struct connectionObject_notice));
|
malloc(sizeof(struct connectionObject_notice));
|
||||||
notice->message = strdup(message);
|
notice->message = strdup(message);
|
||||||
notice->next = self->notice_pending;
|
notice->next = self->notice_pending;
|
||||||
|
@ -64,10 +64,11 @@ conn_notice_callback(void *args, const char *message)
|
||||||
void
|
void
|
||||||
conn_notice_process(connectionObject *self)
|
conn_notice_process(connectionObject *self)
|
||||||
{
|
{
|
||||||
|
struct connectionObject_notice *notice;
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
pthread_mutex_lock(&self->lock);
|
pthread_mutex_lock(&self->lock);
|
||||||
|
|
||||||
struct connectionObject_notice *notice = self->notice_pending;
|
notice = self->notice_pending;
|
||||||
|
|
||||||
while (notice != NULL) {
|
while (notice != NULL) {
|
||||||
Py_BLOCK_THREADS;
|
Py_BLOCK_THREADS;
|
||||||
|
@ -97,10 +98,11 @@ conn_notice_process(connectionObject *self)
|
||||||
void
|
void
|
||||||
conn_notice_clean(connectionObject *self)
|
conn_notice_clean(connectionObject *self)
|
||||||
{
|
{
|
||||||
|
struct connectionObject_notice *tmp, *notice;
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
pthread_mutex_lock(&self->lock);
|
pthread_mutex_lock(&self->lock);
|
||||||
|
|
||||||
struct connectionObject_notice *tmp, *notice = self->notice_pending;
|
notice = self->notice_pending;
|
||||||
|
|
||||||
while (notice != NULL) {
|
while (notice != NULL) {
|
||||||
tmp = notice;
|
tmp = notice;
|
||||||
|
|
|
@ -684,7 +684,7 @@ static PyObject *
|
||||||
_psyco_curs_buildrow_fill(cursorObject *self, PyObject *res,
|
_psyco_curs_buildrow_fill(cursorObject *self, PyObject *res,
|
||||||
int row, int n, int istuple)
|
int row, int n, int istuple)
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len, err;
|
||||||
const char *str;
|
const char *str;
|
||||||
PyObject *val;
|
PyObject *val;
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res,
|
||||||
PyTuple_SET_ITEM(res, i, val);
|
PyTuple_SET_ITEM(res, i, val);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int err = PySequence_SetItem(res, i, val);
|
err = PySequence_SetItem(res, i, val);
|
||||||
Py_DECREF(val);
|
Py_DECREF(val);
|
||||||
if (err == -1) {
|
if (err == -1) {
|
||||||
Py_DECREF(res);
|
Py_DECREF(res);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user