Fossil SCM

Unnecessary blob_zero() calls: the following prompt_user() call already does a blob_zero() call internally.

jan.nijtmans 2014-02-20 09:42 trunk
Commit 14768c24e5080377fdc7a7a0b8bc0ebd438eb7df
-1
--- src/add.c
+++ src/add.c
@@ -299,11 +299,10 @@
299299
if( !forceFlag && glob_match(pIgnore, zTreeName) ){
300300
Blob ans;
301301
char cReply;
302302
char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
303303
"Add it (a=all/y/N)? ", zTreeName);
304
- blob_zero(&ans);
305304
prompt_user(prompt, &ans);
306305
cReply = blob_str(&ans)[0];
307306
blob_reset(&ans);
308307
if( cReply=='a' || cReply=='A' ){
309308
forceFlag = 1;
310309
--- src/add.c
+++ src/add.c
@@ -299,11 +299,10 @@
299 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
300 Blob ans;
301 char cReply;
302 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
303 "Add it (a=all/y/N)? ", zTreeName);
304 blob_zero(&ans);
305 prompt_user(prompt, &ans);
306 cReply = blob_str(&ans)[0];
307 blob_reset(&ans);
308 if( cReply=='a' || cReply=='A' ){
309 forceFlag = 1;
310
--- src/add.c
+++ src/add.c
@@ -299,11 +299,10 @@
299 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
300 Blob ans;
301 char cReply;
302 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
303 "Add it (a=all/y/N)? ", zTreeName);
 
304 prompt_user(prompt, &ans);
305 cReply = blob_str(&ans)[0];
306 blob_reset(&ans);
307 if( cReply=='a' || cReply=='A' ){
308 forceFlag = 1;
309
--- src/branch.c
+++ src/branch.c
@@ -140,11 +140,10 @@
140140
md5sum_blob(&branch, &mcksum);
141141
blob_appendf(&branch, "Z %b\n", &mcksum);
142142
if( !noSign && clearsign(&branch, &branch) ){
143143
Blob ans;
144144
char cReply;
145
- blob_zero(&ans);
146145
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
147146
cReply = blob_str(&ans)[0];
148147
if( cReply!='y' && cReply!='Y'){
149148
db_end_transaction(1);
150149
fossil_exit(1);
151150
--- src/branch.c
+++ src/branch.c
@@ -140,11 +140,10 @@
140 md5sum_blob(&branch, &mcksum);
141 blob_appendf(&branch, "Z %b\n", &mcksum);
142 if( !noSign && clearsign(&branch, &branch) ){
143 Blob ans;
144 char cReply;
145 blob_zero(&ans);
146 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
147 cReply = blob_str(&ans)[0];
148 if( cReply!='y' && cReply!='Y'){
149 db_end_transaction(1);
150 fossil_exit(1);
151
--- src/branch.c
+++ src/branch.c
@@ -140,11 +140,10 @@
140 md5sum_blob(&branch, &mcksum);
141 blob_appendf(&branch, "Z %b\n", &mcksum);
142 if( !noSign && clearsign(&branch, &branch) ){
143 Blob ans;
144 char cReply;
 
145 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
146 cReply = blob_str(&ans)[0];
147 if( cReply!='y' && cReply!='Y'){
148 db_end_transaction(1);
149 fossil_exit(1);
150
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600600
if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601601
Blob ans;
602602
char cReply;
603603
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604604
zName+nRoot);
605
- blob_zero(&ans);
606605
prompt_user(prompt, &ans);
607606
cReply = blob_str(&ans)[0];
608607
if( cReply=='a' || cReply=='A' ){
609608
allFileFlag = 1;
610609
}else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
642641
if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
643642
Blob ans;
644643
char cReply;
645644
char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
646645
zName+nRoot);
647
- blob_zero(&ans);
648646
prompt_user(prompt, &ans);
649647
cReply = blob_str(&ans)[0];
650648
if( cReply=='a' || cReply=='A' ){
651649
allDirFlag = 1;
652650
}else if( cReply!='y' && cReply!='Y' ){
@@ -1288,11 +1286,10 @@
12881286
}
12891287
zWarning = "Unicode";
12901288
zDisable = "\"encoding-glob\" setting";
12911289
}
12921290
file_relative_name(zFilename, &fname, 0);
1293
- blob_zero(&ans);
12941291
zMsg = mprintf(
12951292
"%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
12961293
"Commit anyhow (a=all/%sy/N)? ",
12971294
blob_str(&fname), zWarning, zDisable, zConvert);
12981295
prompt_user(zMsg, &ans);
@@ -1531,11 +1528,10 @@
15311528
/*
15321529
** Autosync if autosync is enabled and this is not a private check-in.
15331530
*/
15341531
if( !g.markPrivate ){
15351532
if( autosync(SYNC_PULL) ){
1536
- blob_zero(&ans);
15371533
prompt_user("continue in spite of sync failure (y/N)? ", &ans);
15381534
cReply = blob_str(&ans)[0];
15391535
if( cReply!='y' && cReply!='Y' ){
15401536
fossil_exit(1);
15411537
}
@@ -1544,11 +1540,10 @@
15441540
15451541
/* Require confirmation to continue with the check-in if there is
15461542
** clock skew
15471543
*/
15481544
if( g.clockSkewSeen ){
1549
- blob_zero(&ans);
15501545
prompt_user("continue in spite of time skew (y/N)? ", &ans);
15511546
cReply = blob_str(&ans)[0];
15521547
if( cReply!='y' && cReply!='Y' ){
15531548
fossil_exit(1);
15541549
}
@@ -1563,11 +1558,10 @@
15631558
** array is allocated to contain the "id" field from the vfile table
15641559
** for each file to be committed. Or, if aCommitFile is NULL, all files
15651560
** should be committed.
15661561
*/
15671562
if( select_commit_files() ){
1568
- blob_zero(&ans);
15691563
prompt_user("continue (y/N)? ", &ans);
15701564
cReply = blob_str(&ans)[0];
15711565
if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
15721566
}
15731567
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
@@ -1664,20 +1658,18 @@
16641658
blob_zero(&comment);
16651659
}else{
16661660
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
16671661
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
16681662
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1669
- blob_zero(&ans);
16701663
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
16711664
cReply = blob_str(&ans)[0];
16721665
if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
16731666
}
16741667
free(zInit);
16751668
}
16761669
if( blob_size(&comment)==0 ){
16771670
if( !dryRunFlag ){
1678
- blob_zero(&ans);
16791671
prompt_user("empty check-in comment. continue (y/N)? ", &ans);
16801672
cReply = blob_str(&ans)[0];
16811673
if( cReply!='y' && cReply!='Y' ){
16821674
fossil_exit(1);
16831675
}
@@ -1806,11 +1798,10 @@
18061798
}else if( forceDelta ){
18071799
fossil_fatal("unable to find a baseline-manifest for the delta");
18081800
}
18091801
}
18101802
if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1811
- blob_zero(&ans);
18121803
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
18131804
cReply = blob_str(&ans)[0];
18141805
if( cReply!='y' && cReply!='Y' ){
18151806
fossil_exit(1);
18161807
}
18171808
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601 Blob ans;
602 char cReply;
603 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604 zName+nRoot);
605 blob_zero(&ans);
606 prompt_user(prompt, &ans);
607 cReply = blob_str(&ans)[0];
608 if( cReply=='a' || cReply=='A' ){
609 allFileFlag = 1;
610 }else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
642 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
643 Blob ans;
644 char cReply;
645 char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
646 zName+nRoot);
647 blob_zero(&ans);
648 prompt_user(prompt, &ans);
649 cReply = blob_str(&ans)[0];
650 if( cReply=='a' || cReply=='A' ){
651 allDirFlag = 1;
652 }else if( cReply!='y' && cReply!='Y' ){
@@ -1288,11 +1286,10 @@
1288 }
1289 zWarning = "Unicode";
1290 zDisable = "\"encoding-glob\" setting";
1291 }
1292 file_relative_name(zFilename, &fname, 0);
1293 blob_zero(&ans);
1294 zMsg = mprintf(
1295 "%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
1296 "Commit anyhow (a=all/%sy/N)? ",
1297 blob_str(&fname), zWarning, zDisable, zConvert);
1298 prompt_user(zMsg, &ans);
@@ -1531,11 +1528,10 @@
1531 /*
1532 ** Autosync if autosync is enabled and this is not a private check-in.
1533 */
1534 if( !g.markPrivate ){
1535 if( autosync(SYNC_PULL) ){
1536 blob_zero(&ans);
1537 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1538 cReply = blob_str(&ans)[0];
1539 if( cReply!='y' && cReply!='Y' ){
1540 fossil_exit(1);
1541 }
@@ -1544,11 +1540,10 @@
1544
1545 /* Require confirmation to continue with the check-in if there is
1546 ** clock skew
1547 */
1548 if( g.clockSkewSeen ){
1549 blob_zero(&ans);
1550 prompt_user("continue in spite of time skew (y/N)? ", &ans);
1551 cReply = blob_str(&ans)[0];
1552 if( cReply!='y' && cReply!='Y' ){
1553 fossil_exit(1);
1554 }
@@ -1563,11 +1558,10 @@
1563 ** array is allocated to contain the "id" field from the vfile table
1564 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1565 ** should be committed.
1566 */
1567 if( select_commit_files() ){
1568 blob_zero(&ans);
1569 prompt_user("continue (y/N)? ", &ans);
1570 cReply = blob_str(&ans)[0];
1571 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1572 }
1573 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
@@ -1664,20 +1658,18 @@
1664 blob_zero(&comment);
1665 }else{
1666 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1667 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1668 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1669 blob_zero(&ans);
1670 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1671 cReply = blob_str(&ans)[0];
1672 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1673 }
1674 free(zInit);
1675 }
1676 if( blob_size(&comment)==0 ){
1677 if( !dryRunFlag ){
1678 blob_zero(&ans);
1679 prompt_user("empty check-in comment. continue (y/N)? ", &ans);
1680 cReply = blob_str(&ans)[0];
1681 if( cReply!='y' && cReply!='Y' ){
1682 fossil_exit(1);
1683 }
@@ -1806,11 +1798,10 @@
1806 }else if( forceDelta ){
1807 fossil_fatal("unable to find a baseline-manifest for the delta");
1808 }
1809 }
1810 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1811 blob_zero(&ans);
1812 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
1813 cReply = blob_str(&ans)[0];
1814 if( cReply!='y' && cReply!='Y' ){
1815 fossil_exit(1);
1816 }
1817
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601 Blob ans;
602 char cReply;
603 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604 zName+nRoot);
 
605 prompt_user(prompt, &ans);
606 cReply = blob_str(&ans)[0];
607 if( cReply=='a' || cReply=='A' ){
608 allFileFlag = 1;
609 }else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
641 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
642 Blob ans;
643 char cReply;
644 char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
645 zName+nRoot);
 
646 prompt_user(prompt, &ans);
647 cReply = blob_str(&ans)[0];
648 if( cReply=='a' || cReply=='A' ){
649 allDirFlag = 1;
650 }else if( cReply!='y' && cReply!='Y' ){
@@ -1288,11 +1286,10 @@
1286 }
1287 zWarning = "Unicode";
1288 zDisable = "\"encoding-glob\" setting";
1289 }
1290 file_relative_name(zFilename, &fname, 0);
 
1291 zMsg = mprintf(
1292 "%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
1293 "Commit anyhow (a=all/%sy/N)? ",
1294 blob_str(&fname), zWarning, zDisable, zConvert);
1295 prompt_user(zMsg, &ans);
@@ -1531,11 +1528,10 @@
1528 /*
1529 ** Autosync if autosync is enabled and this is not a private check-in.
1530 */
1531 if( !g.markPrivate ){
1532 if( autosync(SYNC_PULL) ){
 
1533 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1534 cReply = blob_str(&ans)[0];
1535 if( cReply!='y' && cReply!='Y' ){
1536 fossil_exit(1);
1537 }
@@ -1544,11 +1540,10 @@
1540
1541 /* Require confirmation to continue with the check-in if there is
1542 ** clock skew
1543 */
1544 if( g.clockSkewSeen ){
 
1545 prompt_user("continue in spite of time skew (y/N)? ", &ans);
1546 cReply = blob_str(&ans)[0];
1547 if( cReply!='y' && cReply!='Y' ){
1548 fossil_exit(1);
1549 }
@@ -1563,11 +1558,10 @@
1558 ** array is allocated to contain the "id" field from the vfile table
1559 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1560 ** should be committed.
1561 */
1562 if( select_commit_files() ){
 
1563 prompt_user("continue (y/N)? ", &ans);
1564 cReply = blob_str(&ans)[0];
1565 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1566 }
1567 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
@@ -1664,20 +1658,18 @@
1658 blob_zero(&comment);
1659 }else{
1660 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1661 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1662 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
 
1663 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1664 cReply = blob_str(&ans)[0];
1665 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1666 }
1667 free(zInit);
1668 }
1669 if( blob_size(&comment)==0 ){
1670 if( !dryRunFlag ){
 
1671 prompt_user("empty check-in comment. continue (y/N)? ", &ans);
1672 cReply = blob_str(&ans)[0];
1673 if( cReply!='y' && cReply!='Y' ){
1674 fossil_exit(1);
1675 }
@@ -1806,11 +1798,10 @@
1798 }else if( forceDelta ){
1799 fossil_fatal("unable to find a baseline-manifest for the delta");
1800 }
1801 }
1802 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
 
1803 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
1804 cReply = blob_str(&ans)[0];
1805 if( cReply!='y' && cReply!='Y' ){
1806 fossil_exit(1);
1807 }
1808
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793793
db_close(1);
794794
db_open_repository(g.zRepositoryName);
795795
if( !bForce ){
796796
Blob ans;
797797
char cReply;
798
- blob_zero(&ans);
799798
prompt_user(
800799
"Scrubbing the repository will permanently delete information.\n"
801800
"Changes cannot be undone. Continue (y/N)? ", &ans);
802801
cReply = blob_str(&ans)[0];
803802
if( cReply!='y' && cReply!='Y' ){
804803
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793 db_close(1);
794 db_open_repository(g.zRepositoryName);
795 if( !bForce ){
796 Blob ans;
797 char cReply;
798 blob_zero(&ans);
799 prompt_user(
800 "Scrubbing the repository will permanently delete information.\n"
801 "Changes cannot be undone. Continue (y/N)? ", &ans);
802 cReply = blob_str(&ans)[0];
803 if( cReply!='y' && cReply!='Y' ){
804
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793 db_close(1);
794 db_open_repository(g.zRepositoryName);
795 if( !bForce ){
796 Blob ans;
797 char cReply;
 
798 prompt_user(
799 "Scrubbing the repository will permanently delete information.\n"
800 "Changes cannot be undone. Continue (y/N)? ", &ans);
801 cReply = blob_str(&ans)[0];
802 if( cReply!='y' && cReply!='Y' ){
803
--- src/stash.c
+++ src/stash.c
@@ -568,11 +568,10 @@
568568
if( memcmp(zCmd, "drop", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0 ){
569569
int allFlag = find_option("all", "a", 0)!=0;
570570
if( allFlag ){
571571
Blob ans;
572572
char cReply;
573
- blob_zero(&ans);
574573
prompt_user("This action is not undoable. Continue (y/N)? ", &ans);
575574
cReply = blob_str(&ans)[0];
576575
if( cReply=='y' || cReply=='Y' ){
577576
db_multi_exec("DELETE FROM stash; DELETE FROM stashfile;");
578577
}
579578
--- src/stash.c
+++ src/stash.c
@@ -568,11 +568,10 @@
568 if( memcmp(zCmd, "drop", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0 ){
569 int allFlag = find_option("all", "a", 0)!=0;
570 if( allFlag ){
571 Blob ans;
572 char cReply;
573 blob_zero(&ans);
574 prompt_user("This action is not undoable. Continue (y/N)? ", &ans);
575 cReply = blob_str(&ans)[0];
576 if( cReply=='y' || cReply=='Y' ){
577 db_multi_exec("DELETE FROM stash; DELETE FROM stashfile;");
578 }
579
--- src/stash.c
+++ src/stash.c
@@ -568,11 +568,10 @@
568 if( memcmp(zCmd, "drop", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0 ){
569 int allFlag = find_option("all", "a", 0)!=0;
570 if( allFlag ){
571 Blob ans;
572 char cReply;
 
573 prompt_user("This action is not undoable. Continue (y/N)? ", &ans);
574 cReply = blob_str(&ans)[0];
575 if( cReply=='y' || cReply=='Y' ){
576 db_multi_exec("DELETE FROM stash; DELETE FROM stashfile;");
577 }
578

Keyboard Shortcuts

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