| 126 | tDebugGraphNode *DebugGraphNode_root = NULL; |
| 127 | |
| 128 | tGraphNode *DebugGraph_AddNode(void) { |
| 129 | if (graph_num_nodes == MAX_GRAPH_NODES) |
| 130 | return NULL; |
| 131 | |
| 132 | tDebugGraphNode *curr = DebugGraphNode_root; |
| 133 | |
| 134 | if (!curr) { |
| 135 | curr = DebugGraphNode_root = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode)); |
| 136 | } else { |
| 137 | while (curr->next) { |
| 138 | curr = curr->next; |
| 139 | } |
| 140 | curr->next = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode)); |
| 141 | curr = curr->next; |
| 142 | } |
| 143 | |
| 144 | if (!curr) { |
| 145 | Error("Out of Memory"); |
| 146 | } |
| 147 | |
| 148 | graph_num_nodes++; |
| 149 | curr->next = NULL; |
| 150 | curr->node = new tGraphNode; |
| 151 | |
| 152 | if (!curr->node) { |
| 153 | Error("Out of Memory"); |
| 154 | } |
| 155 | |
| 156 | return curr->node; |
| 157 | } |
| 158 | |
| 159 | tGraphNode *DebugGraph_FindNode(int index) { |
| 160 | if (index >= graph_num_nodes) |
no test coverage detected