=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/targ.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/make/targ.c 2000/11/24 14:36:35 1.29 --- src/usr.bin/make/targ.c 2001/03/02 16:57:26 1.30 *************** *** 1,4 **** ! /* $OpenBSD: targ.c,v 1.29 2000/11/24 14:36:35 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: targ.c,v 1.30 2001/03/02 16:57:26 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* *************** *** 87,101 **** static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else UNUSED ! static char *rcsid = "$OpenBSD: targ.c,v 1.29 2000/11/24 14:36:35 espie Exp $"; #endif #endif /* not lint */ #ifdef CLEANUP static LIST allGNs; /* List of all the GNodes */ #endif ! static struct hash targets; /* a hash table of same */ ! static struct hash_info gnode_info = { offsetof(GNode, name), NULL, hash_alloc, hash_free, element_alloc }; --- 87,101 ---- static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else UNUSED ! static char *rcsid = "$OpenBSD: targ.c,v 1.30 2001/03/02 16:57:26 espie Exp $"; #endif #endif /* not lint */ #ifdef CLEANUP static LIST allGNs; /* List of all the GNodes */ #endif ! static struct ohash targets; /* a hash table of same */ ! static struct ohash_info gnode_info = { offsetof(GNode, name), NULL, hash_alloc, hash_free, element_alloc }; *************** *** 122,128 **** Lst_Init(&allGNs); #endif /* A small make file already creates 200 targets. */ ! hash_init(&targets, 10, &gnode_info); } /*- --- 122,128 ---- Lst_Init(&allGNs); #endif /* A small make file already creates 200 targets. */ ! ohash_init(&targets, 10, &gnode_info); } /*- *************** *** 139,145 **** { #ifdef CLEANUP Lst_Destroy(&allGNs, TargFreeGN); ! hash_delete(&targets); #endif } --- 139,145 ---- { #ifdef CLEANUP Lst_Destroy(&allGNs, TargFreeGN); ! ohash_delete(&targets); #endif } *************** *** 163,169 **** { GNode *gn; ! gn = hash_create_entry(&gnode_info, name, &end); gn->path = NULL; if (name[0] == '-' && name[1] == 'l') { gn->type = OP_LIB; --- 163,169 ---- { GNode *gn; ! gn = ohash_create_entry(&gnode_info, name, &end); gn->path = NULL; if (name[0] == '-' && name[1] == 'l') { gn->type = OP_LIB; *************** *** 253,265 **** GNode *gn; /* node in that element */ unsigned int slot; ! slot = hash_qlookupi(&targets, name, &end); ! gn = hash_find(&targets, slot); if (gn == NULL && (flags & TARG_CREATE)) { gn = Targ_NewGN(name, end); ! hash_insert(&targets, slot, gn); } return gn; --- 253,265 ---- GNode *gn; /* node in that element */ unsigned int slot; ! slot = ohash_qlookupi(&targets, name, &end); ! gn = ohash_find(&targets, slot); if (gn == NULL && (flags & TARG_CREATE)) { gn = Targ_NewGN(name, end); ! ohash_insert(&targets, slot, gn); } return gn; *************** *** 563,575 **** unsigned int i; printf("#*** Input graph:\n"); ! for (gn = hash_first(&targets, &i); gn != NULL; ! gn = hash_next(&targets, &i)) TargPrintNode(gn, pass); printf("\n\n"); printf("#\n# Files that are only sources:\n"); ! for (gn = hash_first(&targets, &i); gn != NULL; ! gn = hash_next(&targets, &i)) TargPrintOnlySrc(gn); printf("#*** Global Variables:\n"); Var_Dump(VAR_GLOBAL); --- 563,575 ---- unsigned int i; printf("#*** Input graph:\n"); ! for (gn = ohash_first(&targets, &i); gn != NULL; ! gn = ohash_next(&targets, &i)) TargPrintNode(gn, pass); printf("\n\n"); printf("#\n# Files that are only sources:\n"); ! for (gn = ohash_first(&targets, &i); gn != NULL; ! gn = ohash_next(&targets, &i)) TargPrintOnlySrc(gn); printf("#*** Global Variables:\n"); Var_Dump(VAR_GLOBAL);