remove a graph by its name
| 139 | |
| 140 | // remove a graph by its name |
| 141 | void Globals_RemoveGraphByName |
| 142 | ( |
| 143 | const char *name // graph name to remove |
| 144 | ) { |
| 145 | ASSERT(name != NULL); |
| 146 | |
| 147 | // acuire write lock |
| 148 | pthread_rwlock_wrlock(&_globals.lock); |
| 149 | |
| 150 | // search for graph |
| 151 | uint64_t i = 0; |
| 152 | uint64_t n = array_len(_globals.graphs_in_keyspace); |
| 153 | for(; i < n; i++) { |
| 154 | GraphContext *gc = _globals.graphs_in_keyspace[i]; |
| 155 | if(strcmp(name, GraphContext_GetName(gc)) == 0) { |
| 156 | break; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | if(i != n) { |
| 161 | // graph located, remove it |
| 162 | array_del_fast(_globals.graphs_in_keyspace, i); |
| 163 | } |
| 164 | |
| 165 | // release lock |
| 166 | pthread_rwlock_unlock(&_globals.lock); |
| 167 | } |
| 168 | |
| 169 | // clear all tracked graphs |
| 170 | void Globals_ClearGraphs |
no test coverage detected