Fossil SCM

unused variable includeDotFiles <p>struct utimbuf -> struct _utimbuf (compiler warning with mingw-w64) <p>a few "const" additions (lower memory footprint, allows C-compiler to optimize better)

jan.nijtmans 2012-10-16 01:11 trunk
Commit 6032dd51f2bca8f714a4b499888707fed9a4123d
+2 -8
--- src/add.c
+++ src/add.c
@@ -21,16 +21,10 @@
2121
#include "config.h"
2222
#include "add.h"
2323
#include <assert.h>
2424
#include <dirent.h>
2525
26
-/*
27
-** Set to true if files whose names begin with "." should be
28
-** included when processing a recursive "add" command.
29
-*/
30
-static int includeDotFiles = 0;
31
-
3226
/*
3327
** This routine returns the names of files in a working checkout that
3428
** are created by Fossil itself, and hence should not be added, deleted,
3529
** or merge, and should be omitted from "clean" and "extra" lists.
3630
**
@@ -39,11 +33,11 @@
3933
*/
4034
const char *fossil_reserved_name(int N){
4135
/* Possible names of the local per-checkout database file and
4236
** its associated journals
4337
*/
44
- static const char *azName[] = {
38
+ static const char *const azName[] = {
4539
"_FOSSIL_",
4640
"_FOSSIL_-journal",
4741
"_FOSSIL_-wal",
4842
"_FOSSIL_-shm",
4943
".fslckout",
@@ -61,11 +55,11 @@
6155
};
6256
6357
/* Names of auxiliary files generated by SQLite when the "manifest"
6458
** properity is enabled
6559
*/
66
- static const char *azManifest[] = {
60
+ static const char *const azManifest[] = {
6761
"manifest",
6862
"manifest.uuid",
6963
};
7064
7165
/* Cached setting "manifest" */
7266
--- src/add.c
+++ src/add.c
@@ -21,16 +21,10 @@
21 #include "config.h"
22 #include "add.h"
23 #include <assert.h>
24 #include <dirent.h>
25
26 /*
27 ** Set to true if files whose names begin with "." should be
28 ** included when processing a recursive "add" command.
29 */
30 static int includeDotFiles = 0;
31
32 /*
33 ** This routine returns the names of files in a working checkout that
34 ** are created by Fossil itself, and hence should not be added, deleted,
35 ** or merge, and should be omitted from "clean" and "extra" lists.
36 **
@@ -39,11 +33,11 @@
39 */
40 const char *fossil_reserved_name(int N){
41 /* Possible names of the local per-checkout database file and
42 ** its associated journals
43 */
44 static const char *azName[] = {
45 "_FOSSIL_",
46 "_FOSSIL_-journal",
47 "_FOSSIL_-wal",
48 "_FOSSIL_-shm",
49 ".fslckout",
@@ -61,11 +55,11 @@
61 };
62
63 /* Names of auxiliary files generated by SQLite when the "manifest"
64 ** properity is enabled
65 */
66 static const char *azManifest[] = {
67 "manifest",
68 "manifest.uuid",
69 };
70
71 /* Cached setting "manifest" */
72
--- src/add.c
+++ src/add.c
@@ -21,16 +21,10 @@
21 #include "config.h"
22 #include "add.h"
23 #include <assert.h>
24 #include <dirent.h>
25
 
 
 
 
 
 
26 /*
27 ** This routine returns the names of files in a working checkout that
28 ** are created by Fossil itself, and hence should not be added, deleted,
29 ** or merge, and should be omitted from "clean" and "extra" lists.
30 **
@@ -39,11 +33,11 @@
33 */
34 const char *fossil_reserved_name(int N){
35 /* Possible names of the local per-checkout database file and
36 ** its associated journals
37 */
38 static const char *const azName[] = {
39 "_FOSSIL_",
40 "_FOSSIL_-journal",
41 "_FOSSIL_-wal",
42 "_FOSSIL_-shm",
43 ".fslckout",
@@ -61,11 +55,11 @@
55 };
56
57 /* Names of auxiliary files generated by SQLite when the "manifest"
58 ** properity is enabled
59 */
60 static const char *const azManifest[] = {
61 "manifest",
62 "manifest.uuid",
63 };
64
65 /* Cached setting "manifest" */
66
+2 -2
--- src/captcha.c
+++ src/captcha.c
@@ -98,11 +98,11 @@
9898
}
9999
#endif /* CAPTCHA==1 */
100100
101101
102102
#if CAPTCHA==2
103
-static const char *azFont2[] = {
103
+static const char *const azFont2[] = {
104104
/* 0 */
105105
" __ ",
106106
" / \\ ",
107107
"| () |",
108108
" \\__/ ",
@@ -223,11 +223,11 @@
223223
return z;
224224
}
225225
#endif /* CAPTCHA==2 */
226226
227227
#if CAPTCHA==3
228
-static const char *azFont3[] = {
228
+static const char *const azFont3[] = {
229229
/* 0 */
230230
" ___ ",
231231
" / _ \\ ",
232232
"| | | |",
233233
"| | | |",
234234
--- src/captcha.c
+++ src/captcha.c
@@ -98,11 +98,11 @@
98 }
99 #endif /* CAPTCHA==1 */
100
101
102 #if CAPTCHA==2
103 static const char *azFont2[] = {
104 /* 0 */
105 " __ ",
106 " / \\ ",
107 "| () |",
108 " \\__/ ",
@@ -223,11 +223,11 @@
223 return z;
224 }
225 #endif /* CAPTCHA==2 */
226
227 #if CAPTCHA==3
228 static const char *azFont3[] = {
229 /* 0 */
230 " ___ ",
231 " / _ \\ ",
232 "| | | |",
233 "| | | |",
234
--- src/captcha.c
+++ src/captcha.c
@@ -98,11 +98,11 @@
98 }
99 #endif /* CAPTCHA==1 */
100
101
102 #if CAPTCHA==2
103 static const char *const azFont2[] = {
104 /* 0 */
105 " __ ",
106 " / \\ ",
107 "| () |",
108 " \\__/ ",
@@ -223,11 +223,11 @@
223 return z;
224 }
225 #endif /* CAPTCHA==2 */
226
227 #if CAPTCHA==3
228 static const char *const azFont3[] = {
229 /* 0 */
230 " ___ ",
231 " / _ \\ ",
232 "| | | |",
233 "| | | |",
234
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1354,13 +1354,13 @@
13541354
13551355
13561356
/*
13571357
** Name of days and months.
13581358
*/
1359
-static const char *azDays[] =
1359
+static const char *const azDays[] =
13601360
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", 0};
1361
-static const char *azMonths[] =
1361
+static const char *const azMonths[] =
13621362
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
13631363
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 0};
13641364
13651365
13661366
/*
13671367
--- src/cgi.c
+++ src/cgi.c
@@ -1354,13 +1354,13 @@
1354
1355
1356 /*
1357 ** Name of days and months.
1358 */
1359 static const char *azDays[] =
1360 {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", 0};
1361 static const char *azMonths[] =
1362 {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
1363 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 0};
1364
1365
1366 /*
1367
--- src/cgi.c
+++ src/cgi.c
@@ -1354,13 +1354,13 @@
1354
1355
1356 /*
1357 ** Name of days and months.
1358 */
1359 static const char *const azDays[] =
1360 {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", 0};
1361 static const char *const azMonths[] =
1362 {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
1363 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 0};
1364
1365
1366 /*
1367
+2 -2
--- src/db.c
+++ src/db.c
@@ -1609,19 +1609,19 @@
16091609
16101610
/*
16111611
** Return true if the string zVal represents "true" (or "false").
16121612
*/
16131613
int is_truth(const char *zVal){
1614
- static const char *azOn[] = { "on", "yes", "true", "1" };
1614
+ static const char *const azOn[] = { "on", "yes", "true", "1" };
16151615
int i;
16161616
for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
16171617
if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
16181618
}
16191619
return 0;
16201620
}
16211621
int is_false(const char *zVal){
1622
- static const char *azOff[] = { "off", "no", "false", "0" };
1622
+ static const char *const azOff[] = { "off", "no", "false", "0" };
16231623
int i;
16241624
for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
16251625
if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
16261626
}
16271627
return 0;
16281628
--- src/db.c
+++ src/db.c
@@ -1609,19 +1609,19 @@
1609
1610 /*
1611 ** Return true if the string zVal represents "true" (or "false").
1612 */
1613 int is_truth(const char *zVal){
1614 static const char *azOn[] = { "on", "yes", "true", "1" };
1615 int i;
1616 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1617 if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
1618 }
1619 return 0;
1620 }
1621 int is_false(const char *zVal){
1622 static const char *azOff[] = { "off", "no", "false", "0" };
1623 int i;
1624 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1625 if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
1626 }
1627 return 0;
1628
--- src/db.c
+++ src/db.c
@@ -1609,19 +1609,19 @@
1609
1610 /*
1611 ** Return true if the string zVal represents "true" (or "false").
1612 */
1613 int is_truth(const char *zVal){
1614 static const char *const azOn[] = { "on", "yes", "true", "1" };
1615 int i;
1616 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1617 if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
1618 }
1619 return 0;
1620 }
1621 int is_false(const char *zVal){
1622 static const char *const azOff[] = { "off", "no", "false", "0" };
1623 int i;
1624 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1625 if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
1626 }
1627 return 0;
1628
+1 -1
--- src/file.c
+++ src/file.c
@@ -402,11 +402,11 @@
402402
memset(tv, 0, sizeof(tv[0])*2);
403403
tv[0].tv_sec = newMTime;
404404
tv[1].tv_sec = newMTime;
405405
utimes(zFilename, tv);
406406
#else
407
- struct utimbuf tb;
407
+ struct _utimbuf tb;
408408
wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
409409
tb.actime = newMTime;
410410
tb.modtime = newMTime;
411411
_wutime(zMbcs, &tb);
412412
fossil_mbcs_free(zMbcs);
413413
--- src/file.c
+++ src/file.c
@@ -402,11 +402,11 @@
402 memset(tv, 0, sizeof(tv[0])*2);
403 tv[0].tv_sec = newMTime;
404 tv[1].tv_sec = newMTime;
405 utimes(zFilename, tv);
406 #else
407 struct utimbuf tb;
408 wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
409 tb.actime = newMTime;
410 tb.modtime = newMTime;
411 _wutime(zMbcs, &tb);
412 fossil_mbcs_free(zMbcs);
413
--- src/file.c
+++ src/file.c
@@ -402,11 +402,11 @@
402 memset(tv, 0, sizeof(tv[0])*2);
403 tv[0].tv_sec = newMTime;
404 tv[1].tv_sec = newMTime;
405 utimes(zFilename, tv);
406 #else
407 struct _utimbuf tb;
408 wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
409 tb.actime = newMTime;
410 tb.modtime = newMTime;
411 _wutime(zMbcs, &tb);
412 fossil_mbcs_free(zMbcs);
413
+1 -1
--- src/report.c
+++ src/report.c
@@ -170,11 +170,11 @@
170170
case SQLITE_SELECT:
171171
case SQLITE_FUNCTION: {
172172
break;
173173
}
174174
case SQLITE_READ: {
175
- static const char *azAllowed[] = {
175
+ static const char *const azAllowed[] = {
176176
"ticket",
177177
"blob",
178178
"filename",
179179
"mlink",
180180
"plink",
181181
--- src/report.c
+++ src/report.c
@@ -170,11 +170,11 @@
170 case SQLITE_SELECT:
171 case SQLITE_FUNCTION: {
172 break;
173 }
174 case SQLITE_READ: {
175 static const char *azAllowed[] = {
176 "ticket",
177 "blob",
178 "filename",
179 "mlink",
180 "plink",
181
--- src/report.c
+++ src/report.c
@@ -170,11 +170,11 @@
170 case SQLITE_SELECT:
171 case SQLITE_FUNCTION: {
172 break;
173 }
174 case SQLITE_READ: {
175 static const char *const azAllowed[] = {
176 "ticket",
177 "blob",
178 "filename",
179 "mlink",
180 "plink",
181
+1 -1
--- src/vfile.c
+++ src/vfile.c
@@ -385,11 +385,11 @@
385385
386386
/*
387387
** Return TRUE if zFile is a temporary file. Return FALSE if not.
388388
*/
389389
static int is_temporary_file(const char *zName){
390
- static const char *azTemp[] = {
390
+ static const char *const azTemp[] = {
391391
"baseline",
392392
"merge",
393393
"original",
394394
"output",
395395
};
396396
--- src/vfile.c
+++ src/vfile.c
@@ -385,11 +385,11 @@
385
386 /*
387 ** Return TRUE if zFile is a temporary file. Return FALSE if not.
388 */
389 static int is_temporary_file(const char *zName){
390 static const char *azTemp[] = {
391 "baseline",
392 "merge",
393 "original",
394 "output",
395 };
396
--- src/vfile.c
+++ src/vfile.c
@@ -385,11 +385,11 @@
385
386 /*
387 ** Return TRUE if zFile is a temporary file. Return FALSE if not.
388 */
389 static int is_temporary_file(const char *zName){
390 static const char *const azTemp[] = {
391 "baseline",
392 "merge",
393 "original",
394 "output",
395 };
396
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -270,11 +270,11 @@
270270
int rid, /* record id of the file to send */
271271
int isPrivate, /* True if rid is a private artifact */
272272
Blob *pContent, /* The content of the file to send */
273273
Blob *pUuid /* The UUID of the file to send */
274274
){
275
- static const char *azQuery[] = {
275
+ static const char *const azQuery[] = {
276276
"SELECT pid FROM plink x"
277277
" WHERE cid=%d"
278278
" AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
279279
" AND NOT EXISTS(SELECT 1 FROM plink y"
280280
" WHERE y.pid=x.cid AND y.cid=x.pid)",
281281
--- src/xfer.c
+++ src/xfer.c
@@ -270,11 +270,11 @@
270 int rid, /* record id of the file to send */
271 int isPrivate, /* True if rid is a private artifact */
272 Blob *pContent, /* The content of the file to send */
273 Blob *pUuid /* The UUID of the file to send */
274 ){
275 static const char *azQuery[] = {
276 "SELECT pid FROM plink x"
277 " WHERE cid=%d"
278 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
279 " AND NOT EXISTS(SELECT 1 FROM plink y"
280 " WHERE y.pid=x.cid AND y.cid=x.pid)",
281
--- src/xfer.c
+++ src/xfer.c
@@ -270,11 +270,11 @@
270 int rid, /* record id of the file to send */
271 int isPrivate, /* True if rid is a private artifact */
272 Blob *pContent, /* The content of the file to send */
273 Blob *pUuid /* The UUID of the file to send */
274 ){
275 static const char *const azQuery[] = {
276 "SELECT pid FROM plink x"
277 " WHERE cid=%d"
278 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
279 " AND NOT EXISTS(SELECT 1 FROM plink y"
280 " WHERE y.pid=x.cid AND y.cid=x.pid)",
281

Keyboard Shortcuts

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