Deleted Added
full compact
hash.c (34461) hash.c (66525)
1/*
2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 *
4 * You may distribute under the terms of the GNU General Public License as
5 * specified in the README file that comes with the CVS source distribution.
6 *
7 * Polk's hash list manager. So cool.
8 */

--- 88 unchanged lines hidden (view full) ---

97
98 /* free up the header nodes for hash lists (if any) */
99 for (i = 0; i < HASHSIZE; i++)
100 {
101 if ((p = (*listp)->hasharray[i]) != (Node *) NULL)
102 {
103 /* put the nodes into the cache */
104#ifndef NOCACHE
1/*
2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 *
4 * You may distribute under the terms of the GNU General Public License as
5 * specified in the README file that comes with the CVS source distribution.
6 *
7 * Polk's hash list manager. So cool.
8 */

--- 88 unchanged lines hidden (view full) ---

97
98 /* free up the header nodes for hash lists (if any) */
99 for (i = 0; i < HASHSIZE; i++)
100 {
101 if ((p = (*listp)->hasharray[i]) != (Node *) NULL)
102 {
103 /* put the nodes into the cache */
104#ifndef NOCACHE
105 p->type = UNKNOWN;
105 p->type = NT_UNKNOWN;
106 p->next = nodecache;
107 nodecache = p;
108#else
109 /* If NOCACHE is defined we turn off the cache. This can make
110 it easier to tools to determine where items were allocated
111 and freed, for tracking down memory leaks and the like. */
112 free (p);
113#endif

--- 28 unchanged lines hidden (view full) ---

142 else
143 {
144 /* make a new one */
145 p = (Node *) xmalloc (sizeof (Node));
146 }
147
148 /* always make it clean */
149 memset ((char *) p, 0, sizeof (Node));
106 p->next = nodecache;
107 nodecache = p;
108#else
109 /* If NOCACHE is defined we turn off the cache. This can make
110 it easier to tools to determine where items were allocated
111 and freed, for tracking down memory leaks and the like. */
112 free (p);
113#endif

--- 28 unchanged lines hidden (view full) ---

142 else
143 {
144 /* make a new one */
145 p = (Node *) xmalloc (sizeof (Node));
146 }
147
148 /* always make it clean */
149 memset ((char *) p, 0, sizeof (Node));
150 p->type = UNKNOWN;
150 p->type = NT_UNKNOWN;
151
152 return (p);
153}
154
155/*
156 * remove a node from it's list (maybe hash list too) and free it
157 */
158void

--- 47 unchanged lines hidden (view full) ---

206freenode (p)
207 Node *p;
208{
209 /* first free the memory */
210 freenode_mem (p);
211
212 /* then put it in the cache */
213#ifndef NOCACHE
151
152 return (p);
153}
154
155/*
156 * remove a node from it's list (maybe hash list too) and free it
157 */
158void

--- 47 unchanged lines hidden (view full) ---

206freenode (p)
207 Node *p;
208{
209 /* first free the memory */
210 freenode_mem (p);
211
212 /* then put it in the cache */
213#ifndef NOCACHE
214 p->type = UNKNOWN;
214 p->type = NT_UNKNOWN;
215 p->next = nodecache;
216 nodecache = p;
217#else
218 free (p);
219#endif
220}
221
222/*

--- 228 unchanged lines hidden (view full) ---

451
452static char *nodetypestring PROTO ((Ntype));
453
454static char *
455nodetypestring (type)
456 Ntype type;
457{
458 switch (type) {
215 p->next = nodecache;
216 nodecache = p;
217#else
218 free (p);
219#endif
220}
221
222/*

--- 228 unchanged lines hidden (view full) ---

451
452static char *nodetypestring PROTO ((Ntype));
453
454static char *
455nodetypestring (type)
456 Ntype type;
457{
458 switch (type) {
459 case UNKNOWN: return("UNKNOWN");
459 case NT_UNKNOWN: return("UNKNOWN");
460 case HEADER: return("HEADER");
461 case ENTRIES: return("ENTRIES");
462 case FILES: return("FILES");
463 case LIST: return("LIST");
464 case RCSNODE: return("RCSNODE");
465 case RCSVERS: return("RCSVERS");
466 case DIRS: return("DIRS");
467 case UPDATE: return("UPDATE");
468 case LOCK: return("LOCK");
469 case NDBMNODE: return("NDBMNODE");
470 case FILEATTR: return("FILEATTR");
471 case VARIABLE: return("VARIABLE");
472 case RCSFIELD: return("RCSFIELD");
460 case HEADER: return("HEADER");
461 case ENTRIES: return("ENTRIES");
462 case FILES: return("FILES");
463 case LIST: return("LIST");
464 case RCSNODE: return("RCSNODE");
465 case RCSVERS: return("RCSVERS");
466 case DIRS: return("DIRS");
467 case UPDATE: return("UPDATE");
468 case LOCK: return("LOCK");
469 case NDBMNODE: return("NDBMNODE");
470 case FILEATTR: return("FILEATTR");
471 case VARIABLE: return("VARIABLE");
472 case RCSFIELD: return("RCSFIELD");
473 case RCSCMPFLD: return("RCSCMPFLD");
473 }
474
475 return("<trash>");
476}
477
478static int printnode PROTO ((Node *, void *));
479static int
480printnode (node, closure)

--- 37 unchanged lines hidden ---
474 }
475
476 return("<trash>");
477}
478
479static int printnode PROTO ((Node *, void *));
480static int
481printnode (node, closure)

--- 37 unchanged lines hidden ---