* free a log context, return 0 if success. */
| 190 | * free a log context, return 0 if success. |
| 191 | */ |
| 192 | XLOG_API void xlog_free(xlog_context* ctx) |
| 193 | { |
| 194 | int i=0; |
| 195 | |
| 196 | if (ctx != NULL){ |
| 197 | for (i = 0; i < ctx->_count; i++) |
| 198 | { |
| 199 | if (ctx->_receivers[i]._file != NULL |
| 200 | && ctx->_receivers[i]._type == RECEIVER_TYPE_FILE) |
| 201 | { |
| 202 | fclose(ctx->_receivers[i]._file); // close the log file |
| 203 | ctx->_receivers[i]._file = NULL; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | pthread_mutex_destroy(&ctx->_mutext); |
| 208 | |
| 209 | free(ctx); |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * append a log data receiver, return 0 if success. |
no outgoing calls
no test coverage detected