summaryrefslogtreecommitdiff
path: root/psycopg/pqpath.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-03-01 02:45:48 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-03-01 02:53:28 +0000
commite1266d52cd9fb48585fb7eb152389b314c1610a8 (patch)
treedd4f119660f3783112d32e1c009a268e4c7d6ab1 /psycopg/pqpath.c
parent5bfb6cdefed3754b2a15e1e3372630691392ca47 (diff)
downloadpsycopg2-e1266d52cd9fb48585fb7eb152389b314c1610a8.tar.gz
More functions annotated for static analysis
Also more return values checked for values < 0 for errors, instead of checking == 0 and leaving the positive side unchecked
Diffstat (limited to 'psycopg/pqpath.c')
-rw-r--r--psycopg/pqpath.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c
index 899c331..e8b8dc6 100644
--- a/psycopg/pqpath.c
+++ b/psycopg/pqpath.c
@@ -304,19 +304,16 @@ pq_clear_async(connectionObject *conn)
Accepted arg values are 1 (nonblocking) and 0 (blocking).
- Return 0 if everything ok, else nonzero.
-
- In case of error, if pyerr is nonzero, set a Python exception.
+ Return 0 if everything ok, else < 0 and set an exception.
*/
-int
-pq_set_non_blocking(connectionObject *conn, int arg, int pyerr)
+RAISES_NEG int
+pq_set_non_blocking(connectionObject *conn, int arg)
{
int ret = PQsetnonblocking(conn->pgconn, arg);
if (0 != ret) {
Dprintf("PQsetnonblocking(%d) FAILED", arg);
- if (pyerr) {
- PyErr_SetString(OperationalError, "PQsetnonblocking() failed");
- }
+ PyErr_SetString(OperationalError, "PQsetnonblocking() failed");
+ ret = -1;
}
return ret;
}