2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
20
** Written by Kiem-Phong Vo (5/26/96)
24
static Void_t* dtmemory(Dt_t* dt,Void_t* addr,size_t size,Dtdisc_t* disc)
26
static Void_t* dtmemory(dt, addr, size, disc)
27
Dt_t* dt; /* dictionary */
28
Void_t* addr; /* address to be manipulate */
29
size_t size; /* size to obtain */
30
Dtdisc_t* disc; /* discipline */
38
else return realloc(addr,size);
40
else return size > 0 ? malloc(size) : NIL(Void_t*);
44
Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t* disc, int type)
46
Dtdisc_t* dtdisc(dt,disc,type)
52
reg Dtsearch_f searchf;
57
if(!(old = dt->disc) ) /* initialization call from dtopen() */
59
if(!(dt->memoryf = disc->memoryf) )
60
dt->memoryf = dtmemory;
64
if(!disc) /* only want to know current discipline */
67
searchf = dt->meth->searchf;
71
if(old->eventf && (*old->eventf)(dt,DT_DISC,(Void_t*)disc,old) < 0)
72
return NIL(Dtdisc_t*);
75
if(!(dt->memoryf = disc->memoryf) )
76
dt->memoryf = dtmemory;
78
if(dt->data->type&(DT_STACK|DT_QUEUE|DT_LIST))
80
else if(dt->data->type&DT_BAG)
81
{ if(type&DT_SAMEHASH)
85
else if(dt->data->type&(DT_SET|DT_BAG))
86
{ if((type&DT_SAMEHASH) && (type&DT_SAMECMP))
90
else /*if(dt->data->type&(DT_OSET|DT_OBAG))*/
95
dt->data->type &= ~DT_FLATTEN;
96
dt->data->here = NIL(Dtlink_t*);
99
if(dt->data->type&(DT_SET|DT_BAG))
100
{ reg Dtlink_t **s, **ends;
101
ends = (s = dt->data->htab) + dt->data->ntab;
103
*s++ = NIL(Dtlink_t*);
109
if(!(type&DT_SAMEHASH)) /* new hash value */
110
{ k = (char*)OBJ(r,disc->link);
111
k = KEY((Void_t*)k,disc->key,disc->size);
112
r->hash = HASH(dt,k,disc,disc->size);
114
(void)(*searchf)(dt,(Void_t*)r,DT_RENEW);