From 204416123385794c92b7767e7702c0d4fd387468 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 4 Oct 2019 15:40:28 +0100 Subject: [PATCH] Deploy the new and `foocmp' macros from mLib. --- catacomb.c | 4 ++-- debian/control | 2 +- ec.c | 16 ++++++++-------- field.c | 16 ++++++++-------- group.c | 14 +++++++------- rand.c | 16 ++++++++-------- setup.py | 2 +- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/catacomb.c b/catacomb.c index affb5d3..572f80f 100644 --- a/catacomb.c +++ b/catacomb.c @@ -140,7 +140,7 @@ static PyObject *meth__ego(PyObject *me, PyObject *arg) char *argv0; if (!PyArg_ParseTuple(arg, "s:_ego", &argv0)) return (0); - if (strcmp(QUIS, "") == 0) + if (STRCMP(QUIS, ==, "")) ego(argv0); RETURN_NONE; } @@ -160,7 +160,7 @@ static void init_random(void) if (!Py_HashRandomizationFlag) return; seed = getenv("PYTHONHASHSEED"); - if (!seed || strcmp(seed, "random") == 0) r = GR_WORD(&rand_global); + if (!seed || STRCMP(seed, ==, "random")) r = GR_WORD(&rand_global); else r = strtoul(seed, 0, 0); if (!r) r = 0xe011f220; /* zero doesn't work well */ unihash_setkey(&unihash_global, r); diff --git a/debian/control b/debian/control index 8b1cd05..84a43a0 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ XS-Python-Version: >= 2.6, << 2.8 Maintainer: Mark Wooding Build-Depends: debhelper (>= 10), pkg-config, python (>= 2.6.6-3~), python-all-dev, - mlib-dev (>= 2.2.2.1), catacomb-dev (>= 2.5.0) + mlib-dev (>= 2.4.99~), catacomb-dev (>= 2.5.0) Standards-Version: 3.8.0 Package: python-catacomb diff --git a/ec.c b/ec.c index f7d6181..6d5e31f 100644 --- a/ec.c +++ b/ec.c @@ -48,13 +48,13 @@ ec_curve *eccurve_copy(ec_curve *c) return (0); a = F_OUT(f, MP_NEW, c->a); b = F_OUT(f, MP_NEW, c->b); - if (strcmp(EC_NAME(c), "prime") == 0) + if (STRCMP(EC_NAME(c), ==, "prime")) c = ec_prime(f, a, b); - else if (strcmp(EC_NAME(c), "primeproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "primeproj")) c = ec_primeproj(f, a, b); - else if (strcmp(EC_NAME(c), "bin") == 0) + else if (STRCMP(EC_NAME(c), ==, "bin")) c = ec_bin(f, a, b); - else if (strcmp(EC_NAME(c), "binproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "binproj")) c = ec_binproj(f, a, b); else c = 0; @@ -984,13 +984,13 @@ PyObject *eccurve_pywrap(PyObject *fobj, ec_curve *c) else Py_INCREF(fobj); assert(FIELD_F(fobj) == c->f); - if (strcmp(EC_NAME(c), "prime") == 0) + if (STRCMP(EC_NAME(c), ==, "prime")) ty = ecprimecurve_pytype; - else if (strcmp(EC_NAME(c), "primeproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "primeproj")) ty = ecprimeprojcurve_pytype; - else if (strcmp(EC_NAME(c), "bin") == 0) + else if (STRCMP(EC_NAME(c), ==, "bin")) ty = ecbincurve_pytype; - else if (strcmp(EC_NAME(c), "binproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "binproj")) ty = ecbinprojcurve_pytype; else abort(); diff --git a/field.c b/field.c index f2a0d2f..b78c166 100644 --- a/field.c +++ b/field.c @@ -74,23 +74,23 @@ PyObject *field_pywrap(field *f) { PyTypeObject *ty; - if (strcmp(F_NAME(f), "prime") == 0) ty = primefield_pytype; - else if (strcmp(F_NAME(f), "niceprime") == 0) ty = niceprimefield_pytype; - else if (strcmp(F_NAME(f), "binpoly") == 0) ty = binpolyfield_pytype; - else if (strcmp(F_NAME(f), "binnorm") == 0) ty = binnormfield_pytype; + if (STRCMP(F_NAME(f), ==, "prime")) ty = primefield_pytype; + else if (STRCMP(F_NAME(f), ==, "niceprime")) ty = niceprimefield_pytype; + else if (STRCMP(F_NAME(f), ==, "binpoly")) ty = binpolyfield_pytype; + else if (STRCMP(F_NAME(f), ==, "binnorm")) ty = binnormfield_pytype; else abort(); return (field_dopywrap(ty, f)); } field *field_copy(field *f) { - if (strcmp(F_NAME(f), "prime") == 0) + if (STRCMP(F_NAME(f), ==, "prime")) f = field_prime(f->m); - else if (strcmp(F_NAME(f), "niceprime") == 0) + else if (STRCMP(F_NAME(f), ==, "niceprime")) f = field_niceprime(f->m); - else if (strcmp(F_NAME(f), "binpoly") == 0) + else if (STRCMP(F_NAME(f), ==, "binpoly")) f = field_binpoly(f->m); - else if (strcmp(F_NAME(f), "binnorm") == 0) { + else if (STRCMP(F_NAME(f), ==, "binnorm")) { fctx_binnorm *fc = (fctx_binnorm *)f; f = field_binnorm(f->m, fc->ntop.r[fc->ntop.n - 1]); } else diff --git a/group.c b/group.c index b5a1815..c3d2386 100644 --- a/group.c +++ b/group.c @@ -453,7 +453,7 @@ PyTypeObject *primegroup_pytype, *bingroup_pytype, *ecgroup_pytype; group *group_copy(group *g) { - if (strcmp(G_NAME(g), "prime") == 0) { + if (STRCMP(G_NAME(g), ==, "prime")) { gctx_prime *gc = (gctx_prime *)g; gprime_param gp; gp.g = G_TOINT(g, MP_NEW, g->g); @@ -461,7 +461,7 @@ group *group_copy(group *g) gp.q = gc->g.r; g = group_prime(&gp); MP_DROP(gp.g); - } else if (strcmp(G_NAME(g), "bin") == 0) { + } else if (STRCMP(G_NAME(g), ==, "bin")) { gctx_bin *gc = (gctx_bin *)g; gbin_param gb; gb.g = G_TOINT(g, MP_NEW, g->g); @@ -469,7 +469,7 @@ group *group_copy(group *g) gb.q = gc->g.r; g = group_binary(&gb); MP_DROP(gb.g); - } else if (strcmp(G_NAME(g), "ec") == 0) { + } else if (STRCMP(G_NAME(g), ==, "ec")) { gctx_ec *gc = (gctx_ec *)g; ec_info ei; if ((ei.c = eccurve_copy(gc->ei.c)) == 0) @@ -552,9 +552,9 @@ PyObject *group_pywrap(group *g) { PyTypeObject *ty; - if (strcmp(G_NAME(g), "prime") == 0) ty = primegroup_pytype; - else if (strcmp(G_NAME(g), "bin") == 0) ty = bingroup_pytype; - else if (strcmp(G_NAME(g), "ec") == 0) ty = ecgroup_pytype; + if (STRCMP(G_NAME(g), ==, "prime")) ty = primegroup_pytype; + else if (STRCMP(G_NAME(g), ==, "bin")) ty = bingroup_pytype; + else if (STRCMP(G_NAME(g), ==, "ec")) ty = ecgroup_pytype; else abort(); return (group_dopywrap(ty, g)); } @@ -732,7 +732,7 @@ static PyObject *gemeth_toec(PyObject *me, PyObject *arg, PyObject *kw) if (!PyType_Check(cty) || !PyType_IsSubtype(cty, ecpt_pytype)) TYERR("want subtype of catacomb.ECPt"); Py_INCREF((PyObject *)cty); - } else if (strcmp(G_NAME(g), "ec") == 0) { + } else if (STRCMP(G_NAME(g), ==, "ec")) { c = eccurve_copy(((gctx_ec *)g)->ei.c); cty = (PyTypeObject *)eccurve_pywrap(0, c); } else { diff --git a/rand.c b/rand.c index 15a0788..964a6a2 100644 --- a/rand.c +++ b/rand.c @@ -56,14 +56,14 @@ PyObject *grand_pywrap(grand *r, unsigned f) PyTypeObject *ty = grand_pytype; PyObject *ob; - if (strcmp(r->ops->name, "rand") == 0) ty = truerand_pytype; - else if (strcmp(r->ops->name, "lcrand") == 0) ty = lcrand_pytype; - else if (strcmp(r->ops->name, "fibrand") == 0) ty = fibrand_pytype; - else if (strcmp(r->ops->name, "dsarand") == 0) ty = dsarand_pytype; - else if (strcmp(r->ops->name, "bbs") == 0) ty = bbs_pytype; - else if (strcmp(r->ops->name, "sslprf") == 0) ty = sslprf_pytype; - else if (strcmp(r->ops->name, "tlsdx") == 0) ty = tlsdx_pytype; - else if (strcmp(r->ops->name, "tlsprf") == 0) ty = tlsprf_pytype; + if (STRCMP(r->ops->name, ==, "rand")) ty = truerand_pytype; + else if (STRCMP(r->ops->name, ==, "lcrand")) ty = lcrand_pytype; + else if (STRCMP(r->ops->name, ==, "fibrand")) ty = fibrand_pytype; + else if (STRCMP(r->ops->name, ==, "dsarand")) ty = dsarand_pytype; + else if (STRCMP(r->ops->name, ==, "bbs")) ty = bbs_pytype; + else if (STRCMP(r->ops->name, ==, "sslprf")) ty = sslprf_pytype; + else if (STRCMP(r->ops->name, ==, "tlsdx")) ty = tlsdx_pytype; + else if (STRCMP(r->ops->name, ==, "tlsprf")) ty = tlsprf_pytype; else if ((ob = PyDict_GetItemString(gccrands_dict, r->ops->name)) != 0) ty = (PyTypeObject *)ob; return (grand_dopywrap(ty, r, f)); diff --git a/setup.py b/setup.py index efa922b..69bf393 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import distutils.core as DC import mdwsetup as MS MS.pkg_config('catacomb', '2.5.0') -MS.pkg_config('mLib', '2.2.2.1') +MS.pkg_config('mLib', '2.4.99~') cat = DC.Extension('catacomb._base', ['catacomb.c', 'bytestring.c', 'buffer.c', -- 2.11.0