From 7b2f9f88dd8c083f42340b027cc6e76727dad6ca Mon Sep 17 00:00:00 2001 From: lericson Date: Mon, 21 Sep 2009 16:47:16 +0200 Subject: [PATCH] Simplify behavior setting method. --- _pylibmcmodule.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/_pylibmcmodule.c b/_pylibmcmodule.c index 31a23b3..500deae 100644 --- a/_pylibmcmodule.c +++ b/_pylibmcmodule.c @@ -721,15 +721,10 @@ static PyObject *PylibMC_Client_set_behaviors(PylibMC_Client *self, if (!PyMapping_HasKeyString(behaviors, b->name)) { continue; - } - - v = PyMapping_GetItemString(behaviors, b->name); - - if (v == NULL) { + } else if ((v = PyMapping_GetItemString(behaviors, b->name)) == NULL) { goto error; } else if (!PyInt_Check(v)) { - PyErr_Format(PyExc_TypeError, "behavior %s must be int", - b->name); + PyErr_Format(PyExc_TypeError, "behavior %s must be int", b->name); goto error; }