Avoid casts from pointers to integers
[suif.git] / src / basesuif / suif1 / alist.cc
blobc0b148f7674dc79ff22b99cae78cd5f77b3e5c11
1 /* Association List Implementation */
3 /* Copyright (c) 1994 Stanford University
5 All rights reserved.
7 This software is provided under the terms described in
8 the "suif_copyright.h" include file. */
10 #include <suif_copyright.h>
12 #define _MODULE_ "libsuif.a"
14 #pragma implementation "alist.h"
16 #define RCS_BASE_FILE alist_cc
18 #include "misc.h"
19 #include "glist.h"
20 #include "mtflist.h"
21 #include "alist.h"
23 RCS_BASE(
24 "$Id: alist.cc,v 1.2 1999/08/25 03:29:08 brm Exp $")
27 /*****************************************************************************/
31 * The search functions in amtflist use the same search function as
32 * mtflist by providing a separate function to compare the keys.
35 static boolean
36 amtflist_pred (alist_e *a, void *k)
38 return a->key == k;
42 alist_e *
43 amtflist::search (void *k)
45 return (alist_e *)mtflist::lookup((mtflist_test_f)amtflist_pred, k);
49 const void *
50 amtflist::lookup (void *k)
52 alist_e *ap = search(k);
53 assert_msg(ap, ("amtflist::lookup - attempt to lookup %x failed", k));
54 return ap->info;
58 boolean
59 amtflist::exists (void *k, const void **i)
61 alist_e *ap = search(k);
62 if (ap) {
63 if (i) *i = ap->info;
64 return TRUE;
66 return FALSE;