Fossil SCM
Fix build on mingw-w64 (which DOES have strtok_r)
Commit
6f52316955f4ba148b241a58e3f82dc3112145f899fbe5ddefe87691c89fb8e3
Parent
04168f51704ed02…
2 files changed
+7
-6
+1
-1
+7
-6
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -49,28 +49,28 @@ | ||
| 49 | 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | 50 | # endif |
| 51 | 51 | #endif |
| 52 | 52 | #include <time.h> |
| 53 | 53 | |
| 54 | -#if defined(__MINGW32__) || defined(_MSC_VER) | |
| 54 | +#ifdef _WIN32 | |
| 55 | 55 | /* |
| 56 | 56 | ** MinGW doesn't have strtok_r in its libc. Here's a public domain one |
| 57 | 57 | ** found at StackOverflow as a work-around, with formatting adjusted to |
| 58 | 58 | ** make it more like the usual style here. This is certainly the wrong |
| 59 | 59 | ** place for it, which is emphasized by making the function static. |
| 60 | -** | |
| 60 | +** | |
| 61 | 61 | ** See http://stackoverflow.com/a/12979321/68204 |
| 62 | -** | |
| 62 | +** | |
| 63 | 63 | ** public domain strtok_r() by Charlie Gordon |
| 64 | 64 | ** from comp.lang.c 9/14/2007 |
| 65 | 65 | ** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684 |
| 66 | 66 | ** (Declaration that it's public domain): |
| 67 | 67 | ** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c |
| 68 | 68 | */ |
| 69 | -static char* strtok_r( | |
| 70 | - char *str, | |
| 71 | - const char *delim, | |
| 69 | +static char* win32_strtok_r( | |
| 70 | + char *str, | |
| 71 | + const char *delim, | |
| 72 | 72 | char **nextp |
| 73 | 73 | ){ |
| 74 | 74 | char *ret; |
| 75 | 75 | if( str == NULL ){ |
| 76 | 76 | str = *nextp; |
| @@ -85,10 +85,11 @@ | ||
| 85 | 85 | *str++ = '\0'; |
| 86 | 86 | } |
| 87 | 87 | *nextp = str; |
| 88 | 88 | return ret; |
| 89 | 89 | } |
| 90 | +#define strtok_r win32_strtok_r | |
| 90 | 91 | #endif |
| 91 | 92 | |
| 92 | 93 | /* |
| 93 | 94 | ** Return the login-group name. Or return 0 if this repository is |
| 94 | 95 | ** not a member of a login-group. |
| 95 | 96 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -49,28 +49,28 @@ | |
| 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | # endif |
| 51 | #endif |
| 52 | #include <time.h> |
| 53 | |
| 54 | #if defined(__MINGW32__) || defined(_MSC_VER) |
| 55 | /* |
| 56 | ** MinGW doesn't have strtok_r in its libc. Here's a public domain one |
| 57 | ** found at StackOverflow as a work-around, with formatting adjusted to |
| 58 | ** make it more like the usual style here. This is certainly the wrong |
| 59 | ** place for it, which is emphasized by making the function static. |
| 60 | ** |
| 61 | ** See http://stackoverflow.com/a/12979321/68204 |
| 62 | ** |
| 63 | ** public domain strtok_r() by Charlie Gordon |
| 64 | ** from comp.lang.c 9/14/2007 |
| 65 | ** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684 |
| 66 | ** (Declaration that it's public domain): |
| 67 | ** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c |
| 68 | */ |
| 69 | static char* strtok_r( |
| 70 | char *str, |
| 71 | const char *delim, |
| 72 | char **nextp |
| 73 | ){ |
| 74 | char *ret; |
| 75 | if( str == NULL ){ |
| 76 | str = *nextp; |
| @@ -85,10 +85,11 @@ | |
| 85 | *str++ = '\0'; |
| 86 | } |
| 87 | *nextp = str; |
| 88 | return ret; |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | /* |
| 93 | ** Return the login-group name. Or return 0 if this repository is |
| 94 | ** not a member of a login-group. |
| 95 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -49,28 +49,28 @@ | |
| 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | # endif |
| 51 | #endif |
| 52 | #include <time.h> |
| 53 | |
| 54 | #ifdef _WIN32 |
| 55 | /* |
| 56 | ** MinGW doesn't have strtok_r in its libc. Here's a public domain one |
| 57 | ** found at StackOverflow as a work-around, with formatting adjusted to |
| 58 | ** make it more like the usual style here. This is certainly the wrong |
| 59 | ** place for it, which is emphasized by making the function static. |
| 60 | ** |
| 61 | ** See http://stackoverflow.com/a/12979321/68204 |
| 62 | ** |
| 63 | ** public domain strtok_r() by Charlie Gordon |
| 64 | ** from comp.lang.c 9/14/2007 |
| 65 | ** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684 |
| 66 | ** (Declaration that it's public domain): |
| 67 | ** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c |
| 68 | */ |
| 69 | static char* win32_strtok_r( |
| 70 | char *str, |
| 71 | const char *delim, |
| 72 | char **nextp |
| 73 | ){ |
| 74 | char *ret; |
| 75 | if( str == NULL ){ |
| 76 | str = *nextp; |
| @@ -85,10 +85,11 @@ | |
| 85 | *str++ = '\0'; |
| 86 | } |
| 87 | *nextp = str; |
| 88 | return ret; |
| 89 | } |
| 90 | #define strtok_r win32_strtok_r |
| 91 | #endif |
| 92 | |
| 93 | /* |
| 94 | ** Return the login-group name. Or return 0 if this repository is |
| 95 | ** not a member of a login-group. |
| 96 |
+1
-1
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -400,11 +400,11 @@ | ||
| 400 | 400 | style_submenu_element("Stat", "stat"); |
| 401 | 401 | style_submenu_element("URLs", "urllist"); |
| 402 | 402 | if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){ |
| 403 | 403 | style_submenu_element("Table Sizes", "repo-tabsize"); |
| 404 | 404 | } |
| 405 | - blob_init(&sql, | |
| 405 | + blob_init(&sql, | |
| 406 | 406 | "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL", -1); |
| 407 | 407 | if( zArg ){ |
| 408 | 408 | style_submenu_element("All", "repo_schema"); |
| 409 | 409 | blob_appendf(&sql, " AND (tbl_name=%Q OR name=%Q)", zArg, zArg); |
| 410 | 410 | } |
| 411 | 411 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -400,11 +400,11 @@ | |
| 400 | style_submenu_element("Stat", "stat"); |
| 401 | style_submenu_element("URLs", "urllist"); |
| 402 | if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){ |
| 403 | style_submenu_element("Table Sizes", "repo-tabsize"); |
| 404 | } |
| 405 | blob_init(&sql, |
| 406 | "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL", -1); |
| 407 | if( zArg ){ |
| 408 | style_submenu_element("All", "repo_schema"); |
| 409 | blob_appendf(&sql, " AND (tbl_name=%Q OR name=%Q)", zArg, zArg); |
| 410 | } |
| 411 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -400,11 +400,11 @@ | |
| 400 | style_submenu_element("Stat", "stat"); |
| 401 | style_submenu_element("URLs", "urllist"); |
| 402 | if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){ |
| 403 | style_submenu_element("Table Sizes", "repo-tabsize"); |
| 404 | } |
| 405 | blob_init(&sql, |
| 406 | "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL", -1); |
| 407 | if( zArg ){ |
| 408 | style_submenu_element("All", "repo_schema"); |
| 409 | blob_appendf(&sql, " AND (tbl_name=%Q OR name=%Q)", zArg, zArg); |
| 410 | } |
| 411 |