Fossil SCM
Some coding style cleanup in order to make fossil_close() static.
Commit
1c6a6fa1a911e4bcd4632e25d93ca6a7bc653b120e809aefbad12c8f69e00e94
Parent
97ff702f3db54eb…
1 file changed
+21
-21
+21
-21
| --- src/sqlcmd.c | ||
| +++ src/sqlcmd.c | ||
| @@ -170,10 +170,31 @@ | ||
| 170 | 170 | ** atexit() handler that cleans up global state modified by this module. |
| 171 | 171 | */ |
| 172 | 172 | static void sqlcmd_atexit(void) { |
| 173 | 173 | g.zConfigDbName = 0; /* prevent panic */ |
| 174 | 174 | } |
| 175 | + | |
| 176 | +/* | |
| 177 | +** This routine is called by the patched sqlite3 command-line shell in order | |
| 178 | +** to load the name and database connection for the open Fossil database. | |
| 179 | +*/ | |
| 180 | +void fossil_open(const char **pzRepoName){ | |
| 181 | + sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); | |
| 182 | + *pzRepoName = g.zRepositoryName; | |
| 183 | +} | |
| 184 | + | |
| 185 | +/* | |
| 186 | +** This routine closes the Fossil databases and/or invalidates the global | |
| 187 | +** state variables that keep track of them. | |
| 188 | +*/ | |
| 189 | +static void fossil_close(int bDb, int noRepository){ | |
| 190 | + if( bDb ) db_close(1); | |
| 191 | + if( noRepository ) g.zRepositoryName = 0; | |
| 192 | + g.db = 0; | |
| 193 | + g.repositoryOpen = 0; | |
| 194 | + g.localOpen = 0; | |
| 195 | +} | |
| 175 | 196 | |
| 176 | 197 | /* |
| 177 | 198 | ** COMMAND: sqlite3 |
| 178 | 199 | ** |
| 179 | 200 | ** Usage: %fossil sql ?OPTIONS? |
| @@ -240,26 +261,5 @@ | ||
| 240 | 261 | g.zConfigDbName = zConfigDb; |
| 241 | 262 | sqlite3_shell(g.argc-1, g.argv+1); |
| 242 | 263 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 243 | 264 | fossil_close(0, noRepository); |
| 244 | 265 | } |
| 245 | - | |
| 246 | -/* | |
| 247 | -** This routine is called by the patched sqlite3 command-line shell in order | |
| 248 | -** to load the name and database connection for the open Fossil database. | |
| 249 | -*/ | |
| 250 | -void fossil_open(const char **pzRepoName){ | |
| 251 | - sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); | |
| 252 | - *pzRepoName = g.zRepositoryName; | |
| 253 | -} | |
| 254 | - | |
| 255 | -/* | |
| 256 | -** This routine closes the Fossil databases and/or invalidates the global | |
| 257 | -** state variables that keep track of them. | |
| 258 | -*/ | |
| 259 | -void fossil_close(int bDb, int noRepository){ | |
| 260 | - if( bDb ) db_close(1); | |
| 261 | - if( noRepository ) g.zRepositoryName = 0; | |
| 262 | - g.db = 0; | |
| 263 | - g.repositoryOpen = 0; | |
| 264 | - g.localOpen = 0; | |
| 265 | -} | |
| 266 | 266 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -170,10 +170,31 @@ | |
| 170 | ** atexit() handler that cleans up global state modified by this module. |
| 171 | */ |
| 172 | static void sqlcmd_atexit(void) { |
| 173 | g.zConfigDbName = 0; /* prevent panic */ |
| 174 | } |
| 175 | |
| 176 | /* |
| 177 | ** COMMAND: sqlite3 |
| 178 | ** |
| 179 | ** Usage: %fossil sql ?OPTIONS? |
| @@ -240,26 +261,5 @@ | |
| 240 | g.zConfigDbName = zConfigDb; |
| 241 | sqlite3_shell(g.argc-1, g.argv+1); |
| 242 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 243 | fossil_close(0, noRepository); |
| 244 | } |
| 245 | |
| 246 | /* |
| 247 | ** This routine is called by the patched sqlite3 command-line shell in order |
| 248 | ** to load the name and database connection for the open Fossil database. |
| 249 | */ |
| 250 | void fossil_open(const char **pzRepoName){ |
| 251 | sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 252 | *pzRepoName = g.zRepositoryName; |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | ** This routine closes the Fossil databases and/or invalidates the global |
| 257 | ** state variables that keep track of them. |
| 258 | */ |
| 259 | void fossil_close(int bDb, int noRepository){ |
| 260 | if( bDb ) db_close(1); |
| 261 | if( noRepository ) g.zRepositoryName = 0; |
| 262 | g.db = 0; |
| 263 | g.repositoryOpen = 0; |
| 264 | g.localOpen = 0; |
| 265 | } |
| 266 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -170,10 +170,31 @@ | |
| 170 | ** atexit() handler that cleans up global state modified by this module. |
| 171 | */ |
| 172 | static void sqlcmd_atexit(void) { |
| 173 | g.zConfigDbName = 0; /* prevent panic */ |
| 174 | } |
| 175 | |
| 176 | /* |
| 177 | ** This routine is called by the patched sqlite3 command-line shell in order |
| 178 | ** to load the name and database connection for the open Fossil database. |
| 179 | */ |
| 180 | void fossil_open(const char **pzRepoName){ |
| 181 | sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 182 | *pzRepoName = g.zRepositoryName; |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | ** This routine closes the Fossil databases and/or invalidates the global |
| 187 | ** state variables that keep track of them. |
| 188 | */ |
| 189 | static void fossil_close(int bDb, int noRepository){ |
| 190 | if( bDb ) db_close(1); |
| 191 | if( noRepository ) g.zRepositoryName = 0; |
| 192 | g.db = 0; |
| 193 | g.repositoryOpen = 0; |
| 194 | g.localOpen = 0; |
| 195 | } |
| 196 | |
| 197 | /* |
| 198 | ** COMMAND: sqlite3 |
| 199 | ** |
| 200 | ** Usage: %fossil sql ?OPTIONS? |
| @@ -240,26 +261,5 @@ | |
| 261 | g.zConfigDbName = zConfigDb; |
| 262 | sqlite3_shell(g.argc-1, g.argv+1); |
| 263 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 264 | fossil_close(0, noRepository); |
| 265 | } |
| 266 |