Renamed from `rsa-decrypt', since the name was no longer appropriate.
[u/mdw/catacomb] / lmem.c
diff --git a/lmem.c b/lmem.c
index e443aa6..a56108a 100644 (file)
--- a/lmem.c
+++ b/lmem.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: lmem.c,v 1.1 1999/12/22 16:02:52 mdw Exp $
+ * $Id: lmem.c,v 1.2 2000/06/17 11:29:20 mdw Exp $
  *
  * Locked memory allocation (Unix-specific)
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lmem.c,v $
+ * Revision 1.2  2000/06/17 11:29:20  mdw
+ * Add arena support.
+ *
  * Revision 1.1  1999/12/22 16:02:52  mdw
  * Interface to allocating `locked' memory (which isn't paged out).
  *
 #  include <sys/mman.h>
 #endif
 
+#include <mLib/arena.h>
 #include <mLib/dstr.h>
 #include <mLib/sub.h>
 
 #include "lmem.h"
 
+/*----- Arena operations --------------------------------------------------*/
+
+static void *aalloc(arena *a, size_t sz) { return l_alloc((lmem *)a, sz); }
+static void afree(arena *a, void *p) { l_free((lmem *)a, p); }
+static void apurge(arena *a) { l_purge((lmem *)a); }
+
+static arena_ops l_ops = { aalloc, arena_fakerealloc, afree, apurge };
+
 /*----- Main code ---------------------------------------------------------*/
 
 /* --- @l_init@ --- *
@@ -83,6 +95,7 @@ int l_init(lmem *lm, size_t sz)
 
   /* --- Preliminaries --- */
 
+  lm->a.ops = &l_ops;
   lm->err = 0;
 
   /* --- Try making a secure locked passphrase buffer --- *