From 8c69751d4fbae6b70015d045632bb65ceae31e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Sat, 11 May 2013 21:55:28 +0200 Subject: [PATCH] Fix compilation warnings --- src/oid.c | 3 +++ src/utils.h | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/oid.c b/src/oid.c index f96fd1e..d1db630 100644 --- a/src/oid.c +++ b/src/oid.c @@ -248,6 +248,9 @@ Oid_richcompare(PyObject *o1, PyObject *o2, int op) case Py_GE: res = (cmp >= 0) ? Py_True: Py_False; break; + default: + PyErr_Format(PyExc_RuntimeError, "Unexpected '%d' op", op); + return NULL; } Py_INCREF(res); diff --git a/src/utils.h b/src/utils.h index 1fb2466..99a89db 100644 --- a/src/utils.h +++ b/src/utils.h @@ -79,7 +79,8 @@ /* Utilities */ -#define to_unicode(x, encoding, errors) to_unicode_n(x, strlen(x), encoding, errors) +#define to_unicode(x, encoding, errors)\ + to_unicode_n(x, strlen(x), encoding, errors) PYGIT2_FN_UNUSED Py_LOCAL_INLINE(PyObject*) @@ -150,8 +151,8 @@ char * py_str_to_c_str(PyObject *value, const char *encoding); /* Helpers to make type init shorter. */ #define INIT_TYPE(type, base, new) \ - if (base != NULL) type.tp_base = base; \ - if (new != NULL) type.tp_new = new; \ + type.tp_base = base; \ + type.tp_new = new; \ if (PyType_Ready(&type) < 0) return NULL; #define ADD_TYPE(module, type) \