Skip to content

Commit 8c69751

Browse files
committed
Fix compilation warnings
1 parent 405d5cc commit 8c69751

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/oid.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ Oid_richcompare(PyObject *o1, PyObject *o2, int op)
248248
case Py_GE:
249249
res = (cmp >= 0) ? Py_True: Py_False;
250250
break;
251+
default:
252+
PyErr_Format(PyExc_RuntimeError, "Unexpected '%d' op", op);
253+
return NULL;
251254
}
252255

253256
Py_INCREF(res);

src/utils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979

8080

8181
/* Utilities */
82-
#define to_unicode(x, encoding, errors) to_unicode_n(x, strlen(x), encoding, errors)
82+
#define to_unicode(x, encoding, errors)\
83+
to_unicode_n(x, strlen(x), encoding, errors)
8384

8485
PYGIT2_FN_UNUSED
8586
Py_LOCAL_INLINE(PyObject*)
@@ -150,8 +151,8 @@ char * py_str_to_c_str(PyObject *value, const char *encoding);
150151

151152
/* Helpers to make type init shorter. */
152153
#define INIT_TYPE(type, base, new) \
153-
if (base != NULL) type.tp_base = base; \
154-
if (new != NULL) type.tp_new = new; \
154+
type.tp_base = base; \
155+
type.tp_new = new; \
155156
if (PyType_Ready(&type) < 0) return NULL;
156157

157158
#define ADD_TYPE(module, type) \

0 commit comments

Comments
 (0)