algorithms.c, knock-on: Eliminate `f_freeme' flags.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 9 Nov 2018 12:22:16 +0000 (12:22 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 10 Nov 2018 01:30:59 +0000 (01:30 +0000)
These were being carefully set and checked on ciphers, hashes, and MACs,
for no good reason because the flag was always set.  Abolish it.

The flag still exists for `grand' objects because they get injected into
Python through the `pgen' event-handling machinery, and Python mustn't
destroy them just because it loses its reference.  (It also mustn't try
to hang onto them, so there's a longstanding bug in there.)

catacomb-python.h

index 364a3c9..d68026d 100644 (file)
@@ -503,21 +503,18 @@ typedef struct gccipher_pyobj {
 extern PyTypeObject *gccipher_pytype;
 #define GCCIPHER_PYCHECK(o) PyObject_TypeCheck((o), gccipher_pytype)
 #define GCCIPHER_CC(o) (((gccipher_pyobj *)(o))->cc)
-#define GCCIPHER_F(o) (((gccipher_pyobj *)(o))->f)
 extern PyObject *gccipher_pywrap(gccipher *);
 extern int convgccipher(PyObject *, void *);
 
 typedef struct gcipher_pyobj {
   PyObject_HEAD
-  unsigned f;
   gcipher *c;
 } gcipher_pyobj;
 
 extern PyTypeObject *gcipher_pytype;
 #define GCIPHER_PYCHECK(o) PyObject_TypeCheck((o), gcipher_pytype)
 #define GCIPHER_C(o) (((gcipher_pyobj *)(o))->c)
-#define GCIPHER_F(o) (((gcipher_pyobj *)(o))->f)
-extern PyObject *gcipher_pywrap(PyObject *, gcipher *, unsigned);
+extern PyObject *gcipher_pywrap(PyObject *, gcipher *);
 extern int convgcipher(PyObject *, void *);
 
 typedef struct gchash_pyobj {
@@ -528,13 +525,11 @@ typedef struct gchash_pyobj {
 extern PyTypeObject *gchash_pytype;
 #define GCHASH_PYCHECK(o) PyObject_TypeCheck((o), gchash_pytype)
 #define GCHASH_CH(o) (((gchash_pyobj *)(o))->ch)
-#define GCHASH_F(o) (((gchash_pyobj *)(o))->f)
 extern PyObject *gchash_pywrap(gchash *);
 extern int convgchash(PyObject *, void *);
 
 typedef struct ghash_pyobj {
   PyObject_HEAD
-  unsigned f;
   ghash *h;
 } ghash_pyobj;
 
@@ -542,8 +537,7 @@ extern PyTypeObject *ghash_pytype, *gmhash_pytype;
 extern PyObject *sha_pyobj, *has160_pyobj;
 #define GHASH_PYCHECK(o) PyObject_TypeCheck((o), ghash_pytype)
 #define GHASH_H(o) (((ghash_pyobj *)(o))->h)
-#define GHASH_F(o) (((ghash_pyobj *)(o))->f)
-extern PyObject *ghash_pywrap(PyObject *, ghash *, unsigned);
+extern PyObject *ghash_pywrap(PyObject *, ghash *);
 extern int convghash(PyObject *, void *);
 extern int convgmhash(PyObject *, void *);
 
@@ -561,7 +555,6 @@ extern int convgcmac(PyObject *, void *);
 
 typedef struct gmac_pyobj {
   PyHeapTypeObject ty;
-  unsigned f;
   gmac *m;
 } gmac_pyobj;
 
@@ -569,7 +562,7 @@ extern PyTypeObject *gmac_pytype;
 #define GMAC_PYCHECK(o) PyObject_TypeCheck((o), gmac_pytype)
 #define GMAC_M(o) (((gmac_pyobj *)(o))->m)
 #define GMAC_F(o) (((gmac_pyobj *)(o))->f)
-extern PyObject *gmac_pywrap(PyObject *, gmac *, unsigned);
+extern PyObject *gmac_pywrap(PyObject *, gmac *);
 extern int convgmac(PyObject *, void *);
 
 /*----- Key generation ----------------------------------------------------*/