chiark / gitweb /
algorithms.c: Reorder the `ghash' definitions.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 7 Apr 2017 10:44:04 +0000 (11:44 +0100)
algorithms.c

index 06fdc3271200f7a99f36fe2786c024dc28bd2e6a..b2eff8b36d5402a1c884af1b93d69cca7bc37681 100644 (file)
@@ -772,27 +772,6 @@ static PyObject *ghmeth_hash(PyObject *me, PyObject *arg)
   RETURN_ME;
 }
 
-static PyObject *ghmeth_done(PyObject *me, PyObject *arg)
-{
-  ghash *g;
-  PyObject *rc;
-  if (!PyArg_ParseTuple(arg, ":done")) return (0);
-  g = GH_COPY(GHASH_H(me));
-  rc = bytestring_pywrap(0, g->ops->c->hashsz);
-  GH_DONE(g, PyString_AS_STRING(rc));
-  GH_DESTROY(g);
-  return (rc);
-}
-
-static PyGetSetDef gchash_pygetset[] = {
-#define GETSETNAME(op, name) gch##op##_##name
-  GET  (bufsz,                 "CH.bufsz -> hash buffer size, or zero")
-  GET  (hashsz,                "CH.hashsz -> hash output size")
-  GET  (name,                  "CH.name -> name of this kind of hash")
-#undef GETSETNAME
-  { 0 }
-};
-
 #define GHMETH_HASHU_(n, W, w)                                         \
   static PyObject *ghmeth_hashu##w(PyObject *me, PyObject *arg)                \
   {                                                                    \
@@ -827,13 +806,36 @@ static PyObject *ghmeth_hashstrz(PyObject *me, PyObject *arg)
   RETURN_ME;
 }
 
+static PyObject *ghmeth_done(PyObject *me, PyObject *arg)
+{
+  ghash *g;
+  PyObject *rc;
+  if (!PyArg_ParseTuple(arg, ":done")) return (0);
+  g = GH_COPY(GHASH_H(me));
+  rc = bytestring_pywrap(0, g->ops->c->hashsz);
+  GH_DONE(g, PyString_AS_STRING(rc));
+  GH_DESTROY(g);
+  return (rc);
+}
+
+static PyGetSetDef gchash_pygetset[] = {
+#define GETSETNAME(op, name) gch##op##_##name
+  GET  (bufsz,                 "CH.bufsz -> hash buffer size, or zero")
+  GET  (hashsz,                "CH.hashsz -> hash output size")
+  GET  (name,                  "CH.name -> name of this kind of hash")
+#undef GETSETNAME
+  { 0 }
+};
+
 static PyMethodDef ghash_pymethods[] = {
 #define METHNAME(name) ghmeth_##name
   METH (hash,                  "H.hash(M)")
 #define METHU_(n, W, w) METH(hashu##w, "H.hashu" #w "(WORD)")
   DOUINTCONV(METHU_)
+#undef METHU_
 #define METHBUF_(n, W, w) METH(hashbuf##w, "H.hashbuf" #w "(BYTES)")
   DOUINTCONV(METHBUF_)
+#undef METHBUF_
   METH (hashstrz,              "H.hashstrz(STRING)")
   METH (done,                  "H.done() -> HASH")
 #undef METHNAME