Use ifdef instead of if to check LO64

This commit is contained in:
Daniele Varrazzo 2014-09-10 23:06:03 +01:00
parent 91eabf5fcb
commit 0205d6ca2e
3 changed files with 5 additions and 7 deletions

View File

@ -389,7 +389,7 @@ lobject_seek(lobjectObject *self, long pos, int whence)
Py_BEGIN_ALLOW_THREADS;
pthread_mutex_lock(&(self->conn->lock));
#if HAVE_LO64
#ifdef HAVE_LO64
if (self->conn->server_version < 90300) {
where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence);
} else {
@ -424,7 +424,7 @@ lobject_tell(lobjectObject *self)
Py_BEGIN_ALLOW_THREADS;
pthread_mutex_lock(&(self->conn->lock));
#if HAVE_LO64
#ifdef HAVE_LO64
if (self->conn->server_version < 90300) {
where = (long)lo_tell(self->conn->pgconn, self->fd);
} else {
@ -489,7 +489,7 @@ lobject_truncate(lobjectObject *self, size_t len)
Py_BEGIN_ALLOW_THREADS;
pthread_mutex_lock(&(self->conn->lock));
#if HAVE_LO64
#ifdef HAVE_LO64
if (self->conn->server_version < 90300) {
retvalue = lo_truncate(self->conn->pgconn, self->fd, len);
} else {

View File

@ -175,7 +175,7 @@ psyco_lobj_seek(lobjectObject *self, PyObject *args)
EXC_IF_LOBJ_LEVEL0(self);
EXC_IF_LOBJ_UNMARKED(self);
#if !HAVE_LO64
#ifndef HAVE_LO64
if (offset > INT_MAX) {
psyco_set_error(InterfaceError, NULL,
"offset out of range");
@ -272,7 +272,7 @@ psyco_lobj_truncate(lobjectObject *self, PyObject *args)
EXC_IF_LOBJ_LEVEL0(self);
EXC_IF_LOBJ_UNMARKED(self);
#if !HAVE_LO64
#ifndef HAVE_LO64
if (len > INT_MAX) {
psyco_set_error(InterfaceError, NULL,
"len out of range");

View File

@ -422,8 +422,6 @@ class psycopg_build_ext(build_ext):
# enable lo64 if postgres >= 9.3
if (pgmajor, pgminor) >= (9, 3):
define_macros.append(("HAVE_LO64", "1"))
else:
define_macros.append(("HAVE_LO64", "0"))
except Warning:
w = sys.exc_info()[1] # work around py 2/3 different syntax