summaryrefslogtreecommitdiff
path: root/psycopg/typecast_datetime.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-04-05 01:25:05 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-04-05 01:25:05 +0100
commitbeea32ef03b6d0e599ae0f2b6b236da857e82077 (patch)
tree72a1f85933a8a03b000d9f678110d5c5a4edbd9f /psycopg/typecast_datetime.c
parent67c82500811c0becf394cc4337c9778a0a763240 (diff)
downloadpsycopg2-beea32ef03b6d0e599ae0f2b6b236da857e82077.tar.gz
Use the Py_RETURN_NONE macro
Diffstat (limited to 'psycopg/typecast_datetime.c')
-rw-r--r--psycopg/typecast_datetime.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/psycopg/typecast_datetime.c b/psycopg/typecast_datetime.c
index 18e9d0d..ad74101 100644
--- a/psycopg/typecast_datetime.c
+++ b/psycopg/typecast_datetime.c
@@ -48,7 +48,7 @@ typecast_PYDATE_cast(const char *str, Py_ssize_t len, PyObject *curs)
PyObject* obj = NULL;
int n, y=0, m=0, d=0;
- if (str == NULL) {Py_INCREF(Py_None); return Py_None;}
+ if (str == NULL) { Py_RETURN_NONE; }
if (!strcmp(str, "infinity") || !strcmp(str, "-infinity")) {
if (str[0] == '-') {
@@ -92,7 +92,7 @@ typecast_PYDATETIME_cast(const char *str, Py_ssize_t len, PyObject *curs)
int hh=0, mm=0, ss=0, us=0, tz=0;
const char *tp = NULL;
- if (str == NULL) {Py_INCREF(Py_None); return Py_None;}
+ if (str == NULL) { Py_RETURN_NONE; }
/* check for infinity */
if (!strcmp(str, "infinity") || !strcmp(str, "-infinity")) {
@@ -177,7 +177,7 @@ typecast_PYTIME_cast(const char *str, Py_ssize_t len, PyObject *curs)
PyObject *tzinfo_factory;
int n, hh=0, mm=0, ss=0, us=0, tz=0;
- if (str == NULL) {Py_INCREF(Py_None); return Py_None;}
+ if (str == NULL) { Py_RETURN_NONE; }
n = typecast_parse_time(str, NULL, &len, &hh, &mm, &ss, &us, &tz);
Dprintf("typecast_PYTIME_cast: n = %d, len = " FORMAT_CODE_PY_SSIZE_T ", "
@@ -226,7 +226,7 @@ typecast_PYINTERVAL_cast(const char *str, Py_ssize_t len, PyObject *curs)
int part = 0, sec;
double micro;
- if (str == NULL) {Py_INCREF(Py_None); return Py_None;}
+ if (str == NULL) { Py_RETURN_NONE; }
Dprintf("typecast_PYINTERVAL_cast: s = %s", str);