|
|
@ -41,6 +41,10 @@ typedef struct gbucket { |
|
|
|
|
|
|
|
|
static GBUCKET GBucket[NUMGBUCKETS]; |
|
|
static GBUCKET GBucket[NUMGBUCKETS]; |
|
|
|
|
|
|
|
|
|
|
|
/* Global variable to indicate that at least one graph exits. Ugly but fast. */ |
|
|
|
|
|
|
|
|
|
|
|
bool Have_graph; |
|
|
|
|
|
|
|
|
/* note: Zero is not a valid id. This is used in plot() in graf.c. */ |
|
|
/* note: Zero is not a valid id. This is used in plot() in graf.c. */ |
|
|
static int RunningId = 1; |
|
|
static int RunningId = 1; |
|
|
|
|
|
|
|
|
@ -81,7 +85,7 @@ GRAPH *NewGraph(void) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RunningId++; |
|
|
RunningId++; |
|
|
|
|
|
|
|
|
|
|
|
Have_graph = TRUE; |
|
|
return pgraph; |
|
|
return pgraph; |
|
|
} /* end of function NewGraph */ |
|
|
} /* end of function NewGraph */ |
|
|
|
|
|
|
|
|
@ -108,7 +112,6 @@ GRAPH *FindGraph(int id) |
|
|
} /* end of function FindGraph */ |
|
|
} /* end of function FindGraph */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GRAPH *CopyGraph(GRAPH *graph) |
|
|
GRAPH *CopyGraph(GRAPH *graph) |
|
|
{ |
|
|
{ |
|
|
GRAPH *ret; |
|
|
GRAPH *ret; |
|
|
@ -235,7 +238,15 @@ int DestroyGraph(int id) |
|
|
lastlist->next = list->next; |
|
|
lastlist->next = list->next; |
|
|
} |
|
|
} |
|
|
else { /* at front */ |
|
|
else { /* at front */ |
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
GBucket[index].list = list->next; |
|
|
GBucket[index].list = list->next; |
|
|
|
|
|
for (i = 0; i < NUMGBUCKETS; ++i) { |
|
|
|
|
|
if (GBucket[i].list) |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
if (i >= NUMGBUCKETS) |
|
|
|
|
|
Have_graph = FALSE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Run through and de-allocate dynamically allocated keyed list */ |
|
|
/* Run through and de-allocate dynamically allocated keyed list */ |
|
|
@ -307,6 +318,7 @@ void FreeGraphs(void) |
|
|
txfree(deadl); |
|
|
txfree(deadl); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
Have_graph = FALSE; |
|
|
} /* end of functdion FreeGraphs */ |
|
|
} /* end of functdion FreeGraphs */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|