Fossil SCM
Put various other constant tables in constant memory.
Commit
214899ac26fb0d048bb027be3fa607b3bb5d1e8c
Parent
52b35c8b401f303…
7 files changed
+2
-2
+1
-1
+1
-1
+1
-1
+2
-2
+1
-1
+1
-1
+2
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -945,12 +945,12 @@ | ||
| 945 | 945 | } |
| 946 | 946 | db_finalize(&q); |
| 947 | 947 | fossil_print("%d non-phantom blobs (out of %d total) checked: %d errors\n", |
| 948 | 948 | n2, n1, nErr); |
| 949 | 949 | if( bParse ){ |
| 950 | - const char *azType[] = { 0, "manifest", "cluster", "control", "wiki", | |
| 951 | - "ticket", "attachment", "event" }; | |
| 950 | + const char *const azType[] = { 0, "manifest", "cluster", "control", | |
| 951 | + "wiki", "ticket", "attachment", "event" }; | |
| 952 | 952 | int i; |
| 953 | 953 | fossil_print("%d total control artifacts\n", nCA); |
| 954 | 954 | for(i=1; i<count(azType); i++){ |
| 955 | 955 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 956 | 956 | } |
| 957 | 957 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -945,12 +945,12 @@ | |
| 945 | } |
| 946 | db_finalize(&q); |
| 947 | fossil_print("%d non-phantom blobs (out of %d total) checked: %d errors\n", |
| 948 | n2, n1, nErr); |
| 949 | if( bParse ){ |
| 950 | const char *azType[] = { 0, "manifest", "cluster", "control", "wiki", |
| 951 | "ticket", "attachment", "event" }; |
| 952 | int i; |
| 953 | fossil_print("%d total control artifacts\n", nCA); |
| 954 | for(i=1; i<count(azType); i++){ |
| 955 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 956 | } |
| 957 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -945,12 +945,12 @@ | |
| 945 | } |
| 946 | db_finalize(&q); |
| 947 | fossil_print("%d non-phantom blobs (out of %d total) checked: %d errors\n", |
| 948 | n2, n1, nErr); |
| 949 | if( bParse ){ |
| 950 | const char *const azType[] = { 0, "manifest", "cluster", "control", |
| 951 | "wiki", "ticket", "attachment", "event" }; |
| 952 | int i; |
| 953 | fossil_print("%d total control artifacts\n", nCA); |
| 954 | for(i=1; i<count(azType); i++){ |
| 955 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 956 | } |
| 957 |
+1
-1
| --- src/moderate.c | ||
| +++ src/moderate.c | ||
| @@ -64,11 +64,11 @@ | ||
| 64 | 64 | |
| 65 | 65 | /* |
| 66 | 66 | ** Check to see if the object identified by RID is used for anything. |
| 67 | 67 | */ |
| 68 | 68 | static int object_used(int rid){ |
| 69 | - static const char *aTabField[] = { | |
| 69 | + static const char *const aTabField[] = { | |
| 70 | 70 | "modreq", "attachRid", |
| 71 | 71 | "mlink", "mid", |
| 72 | 72 | "mlink", "fid", |
| 73 | 73 | "tagxref", "srcid", |
| 74 | 74 | "tagxref", "rid", |
| 75 | 75 |
| --- src/moderate.c | |
| +++ src/moderate.c | |
| @@ -64,11 +64,11 @@ | |
| 64 | |
| 65 | /* |
| 66 | ** Check to see if the object identified by RID is used for anything. |
| 67 | */ |
| 68 | static int object_used(int rid){ |
| 69 | static const char *aTabField[] = { |
| 70 | "modreq", "attachRid", |
| 71 | "mlink", "mid", |
| 72 | "mlink", "fid", |
| 73 | "tagxref", "srcid", |
| 74 | "tagxref", "rid", |
| 75 |
| --- src/moderate.c | |
| +++ src/moderate.c | |
| @@ -64,11 +64,11 @@ | |
| 64 | |
| 65 | /* |
| 66 | ** Check to see if the object identified by RID is used for anything. |
| 67 | */ |
| 68 | static int object_used(int rid){ |
| 69 | static const char *const aTabField[] = { |
| 70 | "modreq", "attachRid", |
| 71 | "mlink", "mid", |
| 72 | "mlink", "fid", |
| 73 | "tagxref", "srcid", |
| 74 | "tagxref", "rid", |
| 75 |
+1
-1
| --- src/printf.c | ||
| +++ src/printf.c | ||
| @@ -918,11 +918,11 @@ | ||
| 918 | 918 | time_t now; |
| 919 | 919 | FILE *out; |
| 920 | 920 | const char *z; |
| 921 | 921 | int i; |
| 922 | 922 | va_list ap; |
| 923 | - static const char *azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT", | |
| 923 | + static const char *const azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT", | |
| 924 | 924 | "PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REQUEST_METHOD", |
| 925 | 925 | "REQUEST_URI", "SCRIPT_NAME" }; |
| 926 | 926 | if( g.zErrlog==0 ) return; |
| 927 | 927 | out = fossil_fopen(g.zErrlog, "a"); |
| 928 | 928 | if( out==0 ) return; |
| 929 | 929 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -918,11 +918,11 @@ | |
| 918 | time_t now; |
| 919 | FILE *out; |
| 920 | const char *z; |
| 921 | int i; |
| 922 | va_list ap; |
| 923 | static const char *azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT", |
| 924 | "PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REQUEST_METHOD", |
| 925 | "REQUEST_URI", "SCRIPT_NAME" }; |
| 926 | if( g.zErrlog==0 ) return; |
| 927 | out = fossil_fopen(g.zErrlog, "a"); |
| 928 | if( out==0 ) return; |
| 929 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -918,11 +918,11 @@ | |
| 918 | time_t now; |
| 919 | FILE *out; |
| 920 | const char *z; |
| 921 | int i; |
| 922 | va_list ap; |
| 923 | static const char *const azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT", |
| 924 | "PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REQUEST_METHOD", |
| 925 | "REQUEST_URI", "SCRIPT_NAME" }; |
| 926 | if( g.zErrlog==0 ) return; |
| 927 | out = fossil_fopen(g.zErrlog, "a"); |
| 928 | if( out==0 ) return; |
| 929 |
+1
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -626,11 +626,11 @@ | ||
| 626 | 626 | if( activateWal ){ |
| 627 | 627 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | if( showStats ){ |
| 631 | - static struct { int idx; const char *zLabel; } aStat[] = { | |
| 631 | + static const struct { int idx; const char *zLabel; } aStat[] = { | |
| 632 | 632 | { CFTYPE_ANY, "Artifacts:" }, |
| 633 | 633 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 634 | 634 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 635 | 635 | { CFTYPE_CONTROL, "Tags:" }, |
| 636 | 636 | { CFTYPE_WIKI, "Wikis:" }, |
| 637 | 637 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -626,11 +626,11 @@ | |
| 626 | if( activateWal ){ |
| 627 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 628 | } |
| 629 | } |
| 630 | if( showStats ){ |
| 631 | static struct { int idx; const char *zLabel; } aStat[] = { |
| 632 | { CFTYPE_ANY, "Artifacts:" }, |
| 633 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 634 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 635 | { CFTYPE_CONTROL, "Tags:" }, |
| 636 | { CFTYPE_WIKI, "Wikis:" }, |
| 637 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -626,11 +626,11 @@ | |
| 626 | if( activateWal ){ |
| 627 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 628 | } |
| 629 | } |
| 630 | if( showStats ){ |
| 631 | static const struct { int idx; const char *zLabel; } aStat[] = { |
| 632 | { CFTYPE_ANY, "Artifacts:" }, |
| 633 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 634 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 635 | { CFTYPE_CONTROL, "Tags:" }, |
| 636 | { CFTYPE_WIKI, "Wikis:" }, |
| 637 |
+2
-2
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -859,11 +859,11 @@ | ||
| 859 | 859 | const char *zLabel, /* The text label on the menu */ |
| 860 | 860 | const char *zVar, /* The corresponding row in the VAR table */ |
| 861 | 861 | const char *zQP, /* The query parameter */ |
| 862 | 862 | const char *zDflt, /* Default value if VAR table entry does not exist */ |
| 863 | 863 | int nChoice, /* Number of choices */ |
| 864 | - const char **azChoice /* Choices. 2 per choice: (VAR value, Display) */ | |
| 864 | + const char *const *azChoice /* Choices. 2 per choice: (VAR value, Display) */ | |
| 865 | 865 | ){ |
| 866 | 866 | const char *z = db_get(zVar, (char*)zDflt); |
| 867 | 867 | const char *zQ = P(zQP); |
| 868 | 868 | int i; |
| 869 | 869 | if( zQ && fossil_strcmp(zQ,z)!=0){ |
| @@ -1151,11 +1151,11 @@ | ||
| 1151 | 1151 | ** WEBPAGE: setup_timeline |
| 1152 | 1152 | */ |
| 1153 | 1153 | void setup_timeline(void){ |
| 1154 | 1154 | double tmDiff; |
| 1155 | 1155 | char zTmDiff[20]; |
| 1156 | - static const char *azTimeFormats[] = { | |
| 1156 | + static const char *const azTimeFormats[] = { | |
| 1157 | 1157 | "0", "HH:MM", |
| 1158 | 1158 | "1", "HH:MM:SS", |
| 1159 | 1159 | "2", "YYYY-MM-DD HH:MM", |
| 1160 | 1160 | "3", "YYMMDD HH:MM" |
| 1161 | 1161 | }; |
| 1162 | 1162 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -859,11 +859,11 @@ | |
| 859 | const char *zLabel, /* The text label on the menu */ |
| 860 | const char *zVar, /* The corresponding row in the VAR table */ |
| 861 | const char *zQP, /* The query parameter */ |
| 862 | const char *zDflt, /* Default value if VAR table entry does not exist */ |
| 863 | int nChoice, /* Number of choices */ |
| 864 | const char **azChoice /* Choices. 2 per choice: (VAR value, Display) */ |
| 865 | ){ |
| 866 | const char *z = db_get(zVar, (char*)zDflt); |
| 867 | const char *zQ = P(zQP); |
| 868 | int i; |
| 869 | if( zQ && fossil_strcmp(zQ,z)!=0){ |
| @@ -1151,11 +1151,11 @@ | |
| 1151 | ** WEBPAGE: setup_timeline |
| 1152 | */ |
| 1153 | void setup_timeline(void){ |
| 1154 | double tmDiff; |
| 1155 | char zTmDiff[20]; |
| 1156 | static const char *azTimeFormats[] = { |
| 1157 | "0", "HH:MM", |
| 1158 | "1", "HH:MM:SS", |
| 1159 | "2", "YYYY-MM-DD HH:MM", |
| 1160 | "3", "YYMMDD HH:MM" |
| 1161 | }; |
| 1162 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -859,11 +859,11 @@ | |
| 859 | const char *zLabel, /* The text label on the menu */ |
| 860 | const char *zVar, /* The corresponding row in the VAR table */ |
| 861 | const char *zQP, /* The query parameter */ |
| 862 | const char *zDflt, /* Default value if VAR table entry does not exist */ |
| 863 | int nChoice, /* Number of choices */ |
| 864 | const char *const *azChoice /* Choices. 2 per choice: (VAR value, Display) */ |
| 865 | ){ |
| 866 | const char *z = db_get(zVar, (char*)zDflt); |
| 867 | const char *zQ = P(zQP); |
| 868 | int i; |
| 869 | if( zQ && fossil_strcmp(zQ,z)!=0){ |
| @@ -1151,11 +1151,11 @@ | |
| 1151 | ** WEBPAGE: setup_timeline |
| 1152 | */ |
| 1153 | void setup_timeline(void){ |
| 1154 | double tmDiff; |
| 1155 | char zTmDiff[20]; |
| 1156 | static const char *const azTimeFormats[] = { |
| 1157 | "0", "HH:MM", |
| 1158 | "1", "HH:MM:SS", |
| 1159 | "2", "YYYY-MM-DD HH:MM", |
| 1160 | "3", "YYMMDD HH:MM" |
| 1161 | }; |
| 1162 |
+1
-1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1264,11 +1264,11 @@ | ||
| 1264 | 1264 | void page_test_env(void){ |
| 1265 | 1265 | char c; |
| 1266 | 1266 | int i; |
| 1267 | 1267 | int showAll; |
| 1268 | 1268 | char zCap[30]; |
| 1269 | - static const char *azCgiVars[] = { | |
| 1269 | + static const char *const azCgiVars[] = { | |
| 1270 | 1270 | "COMSPEC", "DOCUMENT_ROOT", "GATEWAY_INTERFACE", |
| 1271 | 1271 | "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING", |
| 1272 | 1272 | "HTTP_ACCEPT_LANGUAGE", "HTTP_CONNECTION", "HTTP_HOST", |
| 1273 | 1273 | "HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED", |
| 1274 | 1274 | "QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD", |
| 1275 | 1275 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1264,11 +1264,11 @@ | |
| 1264 | void page_test_env(void){ |
| 1265 | char c; |
| 1266 | int i; |
| 1267 | int showAll; |
| 1268 | char zCap[30]; |
| 1269 | static const char *azCgiVars[] = { |
| 1270 | "COMSPEC", "DOCUMENT_ROOT", "GATEWAY_INTERFACE", |
| 1271 | "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING", |
| 1272 | "HTTP_ACCEPT_LANGUAGE", "HTTP_CONNECTION", "HTTP_HOST", |
| 1273 | "HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED", |
| 1274 | "QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD", |
| 1275 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1264,11 +1264,11 @@ | |
| 1264 | void page_test_env(void){ |
| 1265 | char c; |
| 1266 | int i; |
| 1267 | int showAll; |
| 1268 | char zCap[30]; |
| 1269 | static const char *const azCgiVars[] = { |
| 1270 | "COMSPEC", "DOCUMENT_ROOT", "GATEWAY_INTERFACE", |
| 1271 | "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING", |
| 1272 | "HTTP_ACCEPT_LANGUAGE", "HTTP_CONNECTION", "HTTP_HOST", |
| 1273 | "HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED", |
| 1274 | "QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD", |
| 1275 |
+1
-1
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -300,11 +300,11 @@ | ||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /* |
| 303 | 303 | ** Formal names and common names for the various wiki styles. |
| 304 | 304 | */ |
| 305 | -static const char *azStyles[] = { | |
| 305 | +static const char *const azStyles[] = { | |
| 306 | 306 | "text/x-fossil-wiki", "Fossil Wiki", |
| 307 | 307 | "text/x-markdown", "Markdown", |
| 308 | 308 | "text/plain", "Plain Text" |
| 309 | 309 | }; |
| 310 | 310 | |
| 311 | 311 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -300,11 +300,11 @@ | |
| 300 | } |
| 301 | |
| 302 | /* |
| 303 | ** Formal names and common names for the various wiki styles. |
| 304 | */ |
| 305 | static const char *azStyles[] = { |
| 306 | "text/x-fossil-wiki", "Fossil Wiki", |
| 307 | "text/x-markdown", "Markdown", |
| 308 | "text/plain", "Plain Text" |
| 309 | }; |
| 310 | |
| 311 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -300,11 +300,11 @@ | |
| 300 | } |
| 301 | |
| 302 | /* |
| 303 | ** Formal names and common names for the various wiki styles. |
| 304 | */ |
| 305 | static const char *const azStyles[] = { |
| 306 | "text/x-fossil-wiki", "Fossil Wiki", |
| 307 | "text/x-markdown", "Markdown", |
| 308 | "text/plain", "Plain Text" |
| 309 | }; |
| 310 | |
| 311 |