1.0.9.54: clean up old pv updating code
[sbcl/lichteblau.git] / src / runtime / util.h
blob2abf8905c943fa219b3f4540613af42344002e08
1 /*
2 * miscellaneous utilities
3 */
5 /*
6 * This software is part of the SBCL system. See the README file for
7 * more information.
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
17 * a utility to accumulate a zero-terminated array of void* values
19 * (Ah, lovely C, makes it such a delight to accumulate a collection
20 * whose length isn't known in advance.. but it's probably more fun
21 * than trying to teach the SBCL debugger to walk g++ stack frames, not to
22 * mention dealing with g++'s lovely in-which-file-do-templates-expand
23 * issues; or than trying to use Lisp for all accumulation and having to
24 * hassle about FFIing all the details of opendir/readdir/closedir
25 * and so forth.)
27 * We more or less simulate C++-style ctors and dtors.
29 typedef struct
30 voidacc { /* the accumulator itself, to be treated as an opaque data type */
31 /*private:*/
32 void **result;
33 int n_avail;
34 int n_used;
35 } voidacc;
36 int voidacc_ctor(voidacc*); /* the ctor, returning 0 for success */
37 int voidacc_acc(voidacc*, void*); /* Accumulate an element into result,
38 * returning 0 for success. */
39 void** voidacc_give_away_result(voidacc*); /* giving away ownership */
40 void voidacc_dtor(voidacc*); /* the dtor */