| 107 | } |
| 108 | |
| 109 | static void cv_cleanup(cv_proj_t *p) { |
| 110 | if (p->store) { |
| 111 | cbm_store_close(p->store); |
| 112 | } |
| 113 | if (p->srv) { |
| 114 | cbm_mcp_server_free(p->srv); |
| 115 | } |
| 116 | if (p->dbpath[0]) { |
| 117 | char side[1100]; |
| 118 | unlink(p->dbpath); |
| 119 | snprintf(side, sizeof(side), "%s-wal", p->dbpath); |
| 120 | unlink(side); |
| 121 | snprintf(side, sizeof(side), "%s-shm", p->dbpath); |
| 122 | unlink(side); |
| 123 | } |
| 124 | free(p->project); |
| 125 | if (p->tmpdir[0]) { |
| 126 | th_rmtree(p->tmpdir); |
| 127 | } |
| 128 | memset(p, 0, sizeof(*p)); |
| 129 | } |
| 130 | |
| 131 | /* One integer from SQL with text parameters; -1 on any query failure. */ |
| 132 | static int cv_count(cv_proj_t *p, const char *sql, const char *a, const char *b) { |
no test coverage detected