Fossil SCM

Put various other constant tables in constant memory.

jan.nijtmans 2014-01-27 09:08 trunk
Commit 214899ac26fb0d048bb027be3fa607b3bb5d1e8c
+2 -2
--- src/content.c
+++ src/content.c
@@ -945,12 +945,12 @@
945945
}
946946
db_finalize(&q);
947947
fossil_print("%d non-phantom blobs (out of %d total) checked: %d errors\n",
948948
n2, n1, nErr);
949949
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" };
952952
int i;
953953
fossil_print("%d total control artifacts\n", nCA);
954954
for(i=1; i<count(azType); i++){
955955
if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]);
956956
}
957957
--- 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 @@
6464
6565
/*
6666
** Check to see if the object identified by RID is used for anything.
6767
*/
6868
static int object_used(int rid){
69
- static const char *aTabField[] = {
69
+ static const char *const aTabField[] = {
7070
"modreq", "attachRid",
7171
"mlink", "mid",
7272
"mlink", "fid",
7373
"tagxref", "srcid",
7474
"tagxref", "rid",
7575
--- 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 @@
918918
time_t now;
919919
FILE *out;
920920
const char *z;
921921
int i;
922922
va_list ap;
923
- static const char *azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT",
923
+ static const char *const azEnv[] = { "HTTP_HOST", "HTTP_USER_AGENT",
924924
"PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REQUEST_METHOD",
925925
"REQUEST_URI", "SCRIPT_NAME" };
926926
if( g.zErrlog==0 ) return;
927927
out = fossil_fopen(g.zErrlog, "a");
928928
if( out==0 ) return;
929929
--- 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 @@
626626
if( activateWal ){
627627
db_multi_exec("PRAGMA journal_mode=WAL;");
628628
}
629629
}
630630
if( showStats ){
631
- static struct { int idx; const char *zLabel; } aStat[] = {
631
+ static const struct { int idx; const char *zLabel; } aStat[] = {
632632
{ CFTYPE_ANY, "Artifacts:" },
633633
{ CFTYPE_MANIFEST, "Manifests:" },
634634
{ CFTYPE_CLUSTER, "Clusters:" },
635635
{ CFTYPE_CONTROL, "Tags:" },
636636
{ CFTYPE_WIKI, "Wikis:" },
637637
--- 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 @@
859859
const char *zLabel, /* The text label on the menu */
860860
const char *zVar, /* The corresponding row in the VAR table */
861861
const char *zQP, /* The query parameter */
862862
const char *zDflt, /* Default value if VAR table entry does not exist */
863863
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) */
865865
){
866866
const char *z = db_get(zVar, (char*)zDflt);
867867
const char *zQ = P(zQP);
868868
int i;
869869
if( zQ && fossil_strcmp(zQ,z)!=0){
@@ -1151,11 +1151,11 @@
11511151
** WEBPAGE: setup_timeline
11521152
*/
11531153
void setup_timeline(void){
11541154
double tmDiff;
11551155
char zTmDiff[20];
1156
- static const char *azTimeFormats[] = {
1156
+ static const char *const azTimeFormats[] = {
11571157
"0", "HH:MM",
11581158
"1", "HH:MM:SS",
11591159
"2", "YYYY-MM-DD HH:MM",
11601160
"3", "YYMMDD HH:MM"
11611161
};
11621162
--- 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 @@
12641264
void page_test_env(void){
12651265
char c;
12661266
int i;
12671267
int showAll;
12681268
char zCap[30];
1269
- static const char *azCgiVars[] = {
1269
+ static const char *const azCgiVars[] = {
12701270
"COMSPEC", "DOCUMENT_ROOT", "GATEWAY_INTERFACE",
12711271
"HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING",
12721272
"HTTP_ACCEPT_LANGUAGE", "HTTP_CONNECTION", "HTTP_HOST",
12731273
"HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED",
12741274
"QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD",
12751275
--- 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 @@
300300
}
301301
302302
/*
303303
** Formal names and common names for the various wiki styles.
304304
*/
305
-static const char *azStyles[] = {
305
+static const char *const azStyles[] = {
306306
"text/x-fossil-wiki", "Fossil Wiki",
307307
"text/x-markdown", "Markdown",
308308
"text/plain", "Plain Text"
309309
};
310310
311311
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button