Fossil SCM
merged in trunk
Commit
4fb3675a1a5b9962180750f419d34bcf996acbeb
Parent
d3e4ef94b4608d6…
11 files changed
+5
-1
+5
-1
+11
-5
+11
-5
+10
+10
+10
+3
-2
+3
-2
+4
-6
+4
-6
+5
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -642,12 +642,16 @@ | ||
| 642 | 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | 645 | zFile = mprintf("-"); |
| 646 | 646 | }else{ |
| 647 | + Blob fname; | |
| 648 | + blob_zero(&fname); | |
| 649 | + file_relative_name(g.zLocalRoot, &fname, 1); | |
| 647 | 650 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 648 | - g.zLocalRoot); | |
| 651 | + blob_str(&fname)); | |
| 652 | + blob_reset(&fname); | |
| 649 | 653 | } |
| 650 | 654 | #if defined(_WIN32) |
| 651 | 655 | blob_add_cr(pPrompt); |
| 652 | 656 | #endif |
| 653 | 657 | blob_write_to_file(pPrompt, zFile); |
| 654 | 658 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -642,12 +642,16 @@ | |
| 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | zFile = mprintf("-"); |
| 646 | }else{ |
| 647 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 648 | g.zLocalRoot); |
| 649 | } |
| 650 | #if defined(_WIN32) |
| 651 | blob_add_cr(pPrompt); |
| 652 | #endif |
| 653 | blob_write_to_file(pPrompt, zFile); |
| 654 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -642,12 +642,16 @@ | |
| 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | zFile = mprintf("-"); |
| 646 | }else{ |
| 647 | Blob fname; |
| 648 | blob_zero(&fname); |
| 649 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 650 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 651 | blob_str(&fname)); |
| 652 | blob_reset(&fname); |
| 653 | } |
| 654 | #if defined(_WIN32) |
| 655 | blob_add_cr(pPrompt); |
| 656 | #endif |
| 657 | blob_write_to_file(pPrompt, zFile); |
| 658 |
+5
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -642,12 +642,16 @@ | ||
| 642 | 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | 645 | zFile = mprintf("-"); |
| 646 | 646 | }else{ |
| 647 | + Blob fname; | |
| 648 | + blob_zero(&fname); | |
| 649 | + file_relative_name(g.zLocalRoot, &fname, 1); | |
| 647 | 650 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 648 | - g.zLocalRoot); | |
| 651 | + blob_str(&fname)); | |
| 652 | + blob_reset(&fname); | |
| 649 | 653 | } |
| 650 | 654 | #if defined(_WIN32) |
| 651 | 655 | blob_add_cr(pPrompt); |
| 652 | 656 | #endif |
| 653 | 657 | blob_write_to_file(pPrompt, zFile); |
| 654 | 658 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -642,12 +642,16 @@ | |
| 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | zFile = mprintf("-"); |
| 646 | }else{ |
| 647 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 648 | g.zLocalRoot); |
| 649 | } |
| 650 | #if defined(_WIN32) |
| 651 | blob_add_cr(pPrompt); |
| 652 | #endif |
| 653 | blob_write_to_file(pPrompt, zFile); |
| 654 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -642,12 +642,16 @@ | |
| 642 | "# and because no comment was specified using the \"-m\" or \"-M\"\n" |
| 643 | "# command-line options, you will need to enter the comment below.\n" |
| 644 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 645 | zFile = mprintf("-"); |
| 646 | }else{ |
| 647 | Blob fname; |
| 648 | blob_zero(&fname); |
| 649 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 650 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 651 | blob_str(&fname)); |
| 652 | blob_reset(&fname); |
| 653 | } |
| 654 | #if defined(_WIN32) |
| 655 | blob_add_cr(pPrompt); |
| 656 | #endif |
| 657 | blob_write_to_file(pPrompt, zFile); |
| 658 |
+11
-5
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -794,15 +794,16 @@ | ||
| 794 | 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | 795 | */ |
| 796 | 796 | void cmd_test_canonical_name(void){ |
| 797 | 797 | int i; |
| 798 | 798 | Blob x; |
| 799 | + int slashFlag = find_option("slash",0,0)!=0; | |
| 799 | 800 | blob_zero(&x); |
| 800 | 801 | for(i=2; i<g.argc; i++){ |
| 801 | 802 | char zBuf[100]; |
| 802 | 803 | const char *zName = g.argv[i]; |
| 803 | - file_canonical_name(zName, &x, 0); | |
| 804 | + file_canonical_name(zName, &x, slashFlag); | |
| 804 | 805 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 805 | 806 | blob_reset(&x); |
| 806 | 807 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 807 | 808 | fossil_print(" file_size = %s\n", zBuf); |
| 808 | 809 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | ||
| 876 | 877 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 877 | 878 | #else |
| 878 | 879 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 879 | 880 | #endif |
| 880 | 881 | if( zPath[i]==0 ){ |
| 881 | - blob_reset(pOut); | |
| 882 | + memcpy(&tmp, pOut, sizeof(tmp)); | |
| 882 | 883 | if( zPwd[i]==0 ){ |
| 883 | - blob_append(pOut, ".", 1); | |
| 884 | + blob_set(pOut, "."); | |
| 884 | 885 | }else{ |
| 885 | - blob_append(pOut, "..", 2); | |
| 886 | + blob_set(pOut, ".."); | |
| 886 | 887 | for(j=i+1; zPwd[j]; j++){ |
| 887 | 888 | if( zPwd[j]=='/' ){ |
| 888 | 889 | blob_append(pOut, "/..", 3); |
| 889 | 890 | } |
| 890 | 891 | } |
| 891 | 892 | } |
| 893 | + if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){ | |
| 894 | + blob_append(pOut, "/", 1); | |
| 895 | + } | |
| 896 | + blob_reset(&tmp); | |
| 892 | 897 | return; |
| 893 | 898 | } |
| 894 | 899 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 895 | 900 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 896 | 901 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | ||
| 917 | 922 | ** Test the operation of the relative name generator. |
| 918 | 923 | */ |
| 919 | 924 | void cmd_test_relative_name(void){ |
| 920 | 925 | int i; |
| 921 | 926 | Blob x; |
| 927 | + int slashFlag = find_option("slash",0,0)!=0; | |
| 922 | 928 | blob_zero(&x); |
| 923 | 929 | for(i=2; i<g.argc; i++){ |
| 924 | - file_relative_name(g.argv[i], &x, 0); | |
| 930 | + file_relative_name(g.argv[i], &x, slashFlag); | |
| 925 | 931 | fossil_print("%s\n", blob_buffer(&x)); |
| 926 | 932 | blob_reset(&x); |
| 927 | 933 | } |
| 928 | 934 | } |
| 929 | 935 | |
| 930 | 936 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -794,15 +794,16 @@ | |
| 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | */ |
| 796 | void cmd_test_canonical_name(void){ |
| 797 | int i; |
| 798 | Blob x; |
| 799 | blob_zero(&x); |
| 800 | for(i=2; i<g.argc; i++){ |
| 801 | char zBuf[100]; |
| 802 | const char *zName = g.argv[i]; |
| 803 | file_canonical_name(zName, &x, 0); |
| 804 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 805 | blob_reset(&x); |
| 806 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 807 | fossil_print(" file_size = %s\n", zBuf); |
| 808 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | |
| 876 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 877 | #else |
| 878 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 879 | #endif |
| 880 | if( zPath[i]==0 ){ |
| 881 | blob_reset(pOut); |
| 882 | if( zPwd[i]==0 ){ |
| 883 | blob_append(pOut, ".", 1); |
| 884 | }else{ |
| 885 | blob_append(pOut, "..", 2); |
| 886 | for(j=i+1; zPwd[j]; j++){ |
| 887 | if( zPwd[j]=='/' ){ |
| 888 | blob_append(pOut, "/..", 3); |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | return; |
| 893 | } |
| 894 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 895 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 896 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | |
| 917 | ** Test the operation of the relative name generator. |
| 918 | */ |
| 919 | void cmd_test_relative_name(void){ |
| 920 | int i; |
| 921 | Blob x; |
| 922 | blob_zero(&x); |
| 923 | for(i=2; i<g.argc; i++){ |
| 924 | file_relative_name(g.argv[i], &x, 0); |
| 925 | fossil_print("%s\n", blob_buffer(&x)); |
| 926 | blob_reset(&x); |
| 927 | } |
| 928 | } |
| 929 | |
| 930 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -794,15 +794,16 @@ | |
| 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | */ |
| 796 | void cmd_test_canonical_name(void){ |
| 797 | int i; |
| 798 | Blob x; |
| 799 | int slashFlag = find_option("slash",0,0)!=0; |
| 800 | blob_zero(&x); |
| 801 | for(i=2; i<g.argc; i++){ |
| 802 | char zBuf[100]; |
| 803 | const char *zName = g.argv[i]; |
| 804 | file_canonical_name(zName, &x, slashFlag); |
| 805 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 806 | blob_reset(&x); |
| 807 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 808 | fossil_print(" file_size = %s\n", zBuf); |
| 809 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | |
| 877 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 878 | #else |
| 879 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 880 | #endif |
| 881 | if( zPath[i]==0 ){ |
| 882 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 883 | if( zPwd[i]==0 ){ |
| 884 | blob_set(pOut, "."); |
| 885 | }else{ |
| 886 | blob_set(pOut, ".."); |
| 887 | for(j=i+1; zPwd[j]; j++){ |
| 888 | if( zPwd[j]=='/' ){ |
| 889 | blob_append(pOut, "/..", 3); |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){ |
| 894 | blob_append(pOut, "/", 1); |
| 895 | } |
| 896 | blob_reset(&tmp); |
| 897 | return; |
| 898 | } |
| 899 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 900 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 901 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | |
| 922 | ** Test the operation of the relative name generator. |
| 923 | */ |
| 924 | void cmd_test_relative_name(void){ |
| 925 | int i; |
| 926 | Blob x; |
| 927 | int slashFlag = find_option("slash",0,0)!=0; |
| 928 | blob_zero(&x); |
| 929 | for(i=2; i<g.argc; i++){ |
| 930 | file_relative_name(g.argv[i], &x, slashFlag); |
| 931 | fossil_print("%s\n", blob_buffer(&x)); |
| 932 | blob_reset(&x); |
| 933 | } |
| 934 | } |
| 935 | |
| 936 |
+11
-5
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -794,15 +794,16 @@ | ||
| 794 | 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | 795 | */ |
| 796 | 796 | void cmd_test_canonical_name(void){ |
| 797 | 797 | int i; |
| 798 | 798 | Blob x; |
| 799 | + int slashFlag = find_option("slash",0,0)!=0; | |
| 799 | 800 | blob_zero(&x); |
| 800 | 801 | for(i=2; i<g.argc; i++){ |
| 801 | 802 | char zBuf[100]; |
| 802 | 803 | const char *zName = g.argv[i]; |
| 803 | - file_canonical_name(zName, &x, 0); | |
| 804 | + file_canonical_name(zName, &x, slashFlag); | |
| 804 | 805 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 805 | 806 | blob_reset(&x); |
| 806 | 807 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 807 | 808 | fossil_print(" file_size = %s\n", zBuf); |
| 808 | 809 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | ||
| 876 | 877 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 877 | 878 | #else |
| 878 | 879 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 879 | 880 | #endif |
| 880 | 881 | if( zPath[i]==0 ){ |
| 881 | - blob_reset(pOut); | |
| 882 | + memcpy(&tmp, pOut, sizeof(tmp)); | |
| 882 | 883 | if( zPwd[i]==0 ){ |
| 883 | - blob_append(pOut, ".", 1); | |
| 884 | + blob_set(pOut, "."); | |
| 884 | 885 | }else{ |
| 885 | - blob_append(pOut, "..", 2); | |
| 886 | + blob_set(pOut, ".."); | |
| 886 | 887 | for(j=i+1; zPwd[j]; j++){ |
| 887 | 888 | if( zPwd[j]=='/' ){ |
| 888 | 889 | blob_append(pOut, "/..", 3); |
| 889 | 890 | } |
| 890 | 891 | } |
| 891 | 892 | } |
| 893 | + if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){ | |
| 894 | + blob_append(pOut, "/", 1); | |
| 895 | + } | |
| 896 | + blob_reset(&tmp); | |
| 892 | 897 | return; |
| 893 | 898 | } |
| 894 | 899 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 895 | 900 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 896 | 901 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | ||
| 917 | 922 | ** Test the operation of the relative name generator. |
| 918 | 923 | */ |
| 919 | 924 | void cmd_test_relative_name(void){ |
| 920 | 925 | int i; |
| 921 | 926 | Blob x; |
| 927 | + int slashFlag = find_option("slash",0,0)!=0; | |
| 922 | 928 | blob_zero(&x); |
| 923 | 929 | for(i=2; i<g.argc; i++){ |
| 924 | - file_relative_name(g.argv[i], &x, 0); | |
| 930 | + file_relative_name(g.argv[i], &x, slashFlag); | |
| 925 | 931 | fossil_print("%s\n", blob_buffer(&x)); |
| 926 | 932 | blob_reset(&x); |
| 927 | 933 | } |
| 928 | 934 | } |
| 929 | 935 | |
| 930 | 936 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -794,15 +794,16 @@ | |
| 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | */ |
| 796 | void cmd_test_canonical_name(void){ |
| 797 | int i; |
| 798 | Blob x; |
| 799 | blob_zero(&x); |
| 800 | for(i=2; i<g.argc; i++){ |
| 801 | char zBuf[100]; |
| 802 | const char *zName = g.argv[i]; |
| 803 | file_canonical_name(zName, &x, 0); |
| 804 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 805 | blob_reset(&x); |
| 806 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 807 | fossil_print(" file_size = %s\n", zBuf); |
| 808 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | |
| 876 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 877 | #else |
| 878 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 879 | #endif |
| 880 | if( zPath[i]==0 ){ |
| 881 | blob_reset(pOut); |
| 882 | if( zPwd[i]==0 ){ |
| 883 | blob_append(pOut, ".", 1); |
| 884 | }else{ |
| 885 | blob_append(pOut, "..", 2); |
| 886 | for(j=i+1; zPwd[j]; j++){ |
| 887 | if( zPwd[j]=='/' ){ |
| 888 | blob_append(pOut, "/..", 3); |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | return; |
| 893 | } |
| 894 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 895 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 896 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | |
| 917 | ** Test the operation of the relative name generator. |
| 918 | */ |
| 919 | void cmd_test_relative_name(void){ |
| 920 | int i; |
| 921 | Blob x; |
| 922 | blob_zero(&x); |
| 923 | for(i=2; i<g.argc; i++){ |
| 924 | file_relative_name(g.argv[i], &x, 0); |
| 925 | fossil_print("%s\n", blob_buffer(&x)); |
| 926 | blob_reset(&x); |
| 927 | } |
| 928 | } |
| 929 | |
| 930 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -794,15 +794,16 @@ | |
| 794 | ** Also test Fossil's ability to measure attributes of a file. |
| 795 | */ |
| 796 | void cmd_test_canonical_name(void){ |
| 797 | int i; |
| 798 | Blob x; |
| 799 | int slashFlag = find_option("slash",0,0)!=0; |
| 800 | blob_zero(&x); |
| 801 | for(i=2; i<g.argc; i++){ |
| 802 | char zBuf[100]; |
| 803 | const char *zName = g.argv[i]; |
| 804 | file_canonical_name(zName, &x, slashFlag); |
| 805 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 806 | blob_reset(&x); |
| 807 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); |
| 808 | fossil_print(" file_size = %s\n", zBuf); |
| 809 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); |
| @@ -876,21 +877,25 @@ | |
| 877 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 878 | #else |
| 879 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 880 | #endif |
| 881 | if( zPath[i]==0 ){ |
| 882 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 883 | if( zPwd[i]==0 ){ |
| 884 | blob_set(pOut, "."); |
| 885 | }else{ |
| 886 | blob_set(pOut, ".."); |
| 887 | for(j=i+1; zPwd[j]; j++){ |
| 888 | if( zPwd[j]=='/' ){ |
| 889 | blob_append(pOut, "/..", 3); |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){ |
| 894 | blob_append(pOut, "/", 1); |
| 895 | } |
| 896 | blob_reset(&tmp); |
| 897 | return; |
| 898 | } |
| 899 | if( zPwd[i]==0 && zPath[i]=='/' ){ |
| 900 | memcpy(&tmp, pOut, sizeof(tmp)); |
| 901 | blob_set(pOut, "./"); |
| @@ -917,13 +922,14 @@ | |
| 922 | ** Test the operation of the relative name generator. |
| 923 | */ |
| 924 | void cmd_test_relative_name(void){ |
| 925 | int i; |
| 926 | Blob x; |
| 927 | int slashFlag = find_option("slash",0,0)!=0; |
| 928 | blob_zero(&x); |
| 929 | for(i=2; i<g.argc; i++){ |
| 930 | file_relative_name(g.argv[i], &x, slashFlag); |
| 931 | fossil_print("%s\n", blob_buffer(&x)); |
| 932 | blob_reset(&x); |
| 933 | } |
| 934 | } |
| 935 | |
| 936 |
+10
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -344,10 +344,20 @@ | ||
| 344 | 344 | /* |
| 345 | 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | 346 | ** used by fossil. |
| 347 | 347 | */ |
| 348 | 348 | static void fossil_atexit(void) { |
| 349 | +#if defined(_WIN32) && defined(USE_TCL_STUBS) | |
| 350 | + /* If Tcl is compiled on win32 using the latest mingw, | |
| 351 | + * fossil crashes when exiting while Tcl is still loaded. | |
| 352 | + * That's a bug in mingw, see: | |
| 353 | + * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> | |
| 354 | + * but the workaround is not that bad at all: */ | |
| 355 | + if( g.tcl.library ){ | |
| 356 | + FreeLibrary(g.tcl.library); | |
| 357 | + } | |
| 358 | +#endif | |
| 349 | 359 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | 360 | cson_value_free(g.json.gc.v); |
| 351 | 361 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | 362 | #endif |
| 353 | 363 | free(g.zErrMsg); |
| 354 | 364 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | cson_value_free(g.json.gc.v); |
| 351 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | #endif |
| 353 | free(g.zErrMsg); |
| 354 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #if defined(_WIN32) && defined(USE_TCL_STUBS) |
| 350 | /* If Tcl is compiled on win32 using the latest mingw, |
| 351 | * fossil crashes when exiting while Tcl is still loaded. |
| 352 | * That's a bug in mingw, see: |
| 353 | * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> |
| 354 | * but the workaround is not that bad at all: */ |
| 355 | if( g.tcl.library ){ |
| 356 | FreeLibrary(g.tcl.library); |
| 357 | } |
| 358 | #endif |
| 359 | #ifdef FOSSIL_ENABLE_JSON |
| 360 | cson_value_free(g.json.gc.v); |
| 361 | memset(&g.json, 0, sizeof(g.json)); |
| 362 | #endif |
| 363 | free(g.zErrMsg); |
| 364 |
+10
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -344,10 +344,20 @@ | ||
| 344 | 344 | /* |
| 345 | 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | 346 | ** used by fossil. |
| 347 | 347 | */ |
| 348 | 348 | static void fossil_atexit(void) { |
| 349 | +#if defined(_WIN32) && defined(USE_TCL_STUBS) | |
| 350 | + /* If Tcl is compiled on win32 using the latest mingw, | |
| 351 | + * fossil crashes when exiting while Tcl is still loaded. | |
| 352 | + * That's a bug in mingw, see: | |
| 353 | + * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> | |
| 354 | + * but the workaround is not that bad at all: */ | |
| 355 | + if( g.tcl.library ){ | |
| 356 | + FreeLibrary(g.tcl.library); | |
| 357 | + } | |
| 358 | +#endif | |
| 349 | 359 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | 360 | cson_value_free(g.json.gc.v); |
| 351 | 361 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | 362 | #endif |
| 353 | 363 | free(g.zErrMsg); |
| 354 | 364 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | cson_value_free(g.json.gc.v); |
| 351 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | #endif |
| 353 | free(g.zErrMsg); |
| 354 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #if defined(_WIN32) && defined(USE_TCL_STUBS) |
| 350 | /* If Tcl is compiled on win32 using the latest mingw, |
| 351 | * fossil crashes when exiting while Tcl is still loaded. |
| 352 | * That's a bug in mingw, see: |
| 353 | * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> |
| 354 | * but the workaround is not that bad at all: */ |
| 355 | if( g.tcl.library ){ |
| 356 | FreeLibrary(g.tcl.library); |
| 357 | } |
| 358 | #endif |
| 359 | #ifdef FOSSIL_ENABLE_JSON |
| 360 | cson_value_free(g.json.gc.v); |
| 361 | memset(&g.json, 0, sizeof(g.json)); |
| 362 | #endif |
| 363 | free(g.zErrMsg); |
| 364 |
+10
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -344,10 +344,20 @@ | ||
| 344 | 344 | /* |
| 345 | 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | 346 | ** used by fossil. |
| 347 | 347 | */ |
| 348 | 348 | static void fossil_atexit(void) { |
| 349 | +#if defined(_WIN32) && defined(USE_TCL_STUBS) | |
| 350 | + /* If Tcl is compiled on win32 using the latest mingw, | |
| 351 | + * fossil crashes when exiting while Tcl is still loaded. | |
| 352 | + * That's a bug in mingw, see: | |
| 353 | + * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> | |
| 354 | + * but the workaround is not that bad at all: */ | |
| 355 | + if( g.tcl.library ){ | |
| 356 | + FreeLibrary(g.tcl.library); | |
| 357 | + } | |
| 358 | +#endif | |
| 349 | 359 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | 360 | cson_value_free(g.json.gc.v); |
| 351 | 361 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | 362 | #endif |
| 353 | 363 | free(g.zErrMsg); |
| 354 | 364 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | cson_value_free(g.json.gc.v); |
| 351 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | #endif |
| 353 | free(g.zErrMsg); |
| 354 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #if defined(_WIN32) && defined(USE_TCL_STUBS) |
| 350 | /* If Tcl is compiled on win32 using the latest mingw, |
| 351 | * fossil crashes when exiting while Tcl is still loaded. |
| 352 | * That's a bug in mingw, see: |
| 353 | * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> |
| 354 | * but the workaround is not that bad at all: */ |
| 355 | if( g.tcl.library ){ |
| 356 | FreeLibrary(g.tcl.library); |
| 357 | } |
| 358 | #endif |
| 359 | #ifdef FOSSIL_ENABLE_JSON |
| 360 | cson_value_free(g.json.gc.v); |
| 361 | memset(&g.json, 0, sizeof(g.json)); |
| 362 | #endif |
| 363 | free(g.zErrMsg); |
| 364 |
+3
-2
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -671,13 +671,14 @@ | ||
| 671 | 671 | *pxCreateInterp = xCreateInterp; |
| 672 | 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | 673 | return TH_OK; |
| 674 | 674 | } |
| 675 | 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | - fileName[TCL_MINOR_OFFSET]++; | |
| 676 | + fileName[TCL_MINOR_OFFSET] = 'x'; | |
| 677 | 677 | Th_ErrorMessage(interp, |
| 678 | - "could not load Tcl shared library \"", fileName, -1); | |
| 678 | + "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"", | |
| 679 | + fileName, -1); | |
| 679 | 680 | return TH_ERROR; |
| 680 | 681 | #else |
| 681 | 682 | *pLibrary = 0; |
| 682 | 683 | *pxFindExecutable = Tcl_FindExecutable; |
| 683 | 684 | *pxCreateInterp = Tcl_CreateInterp; |
| 684 | 685 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -671,13 +671,14 @@ | |
| 671 | *pxCreateInterp = xCreateInterp; |
| 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | return TH_OK; |
| 674 | } |
| 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | fileName[TCL_MINOR_OFFSET]++; |
| 677 | Th_ErrorMessage(interp, |
| 678 | "could not load Tcl shared library \"", fileName, -1); |
| 679 | return TH_ERROR; |
| 680 | #else |
| 681 | *pLibrary = 0; |
| 682 | *pxFindExecutable = Tcl_FindExecutable; |
| 683 | *pxCreateInterp = Tcl_CreateInterp; |
| 684 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -671,13 +671,14 @@ | |
| 671 | *pxCreateInterp = xCreateInterp; |
| 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | return TH_OK; |
| 674 | } |
| 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | fileName[TCL_MINOR_OFFSET] = 'x'; |
| 677 | Th_ErrorMessage(interp, |
| 678 | "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"", |
| 679 | fileName, -1); |
| 680 | return TH_ERROR; |
| 681 | #else |
| 682 | *pLibrary = 0; |
| 683 | *pxFindExecutable = Tcl_FindExecutable; |
| 684 | *pxCreateInterp = Tcl_CreateInterp; |
| 685 |
+3
-2
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -671,13 +671,14 @@ | ||
| 671 | 671 | *pxCreateInterp = xCreateInterp; |
| 672 | 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | 673 | return TH_OK; |
| 674 | 674 | } |
| 675 | 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | - fileName[TCL_MINOR_OFFSET]++; | |
| 676 | + fileName[TCL_MINOR_OFFSET] = 'x'; | |
| 677 | 677 | Th_ErrorMessage(interp, |
| 678 | - "could not load Tcl shared library \"", fileName, -1); | |
| 678 | + "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"", | |
| 679 | + fileName, -1); | |
| 679 | 680 | return TH_ERROR; |
| 680 | 681 | #else |
| 681 | 682 | *pLibrary = 0; |
| 682 | 683 | *pxFindExecutable = Tcl_FindExecutable; |
| 683 | 684 | *pxCreateInterp = Tcl_CreateInterp; |
| 684 | 685 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -671,13 +671,14 @@ | |
| 671 | *pxCreateInterp = xCreateInterp; |
| 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | return TH_OK; |
| 674 | } |
| 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | fileName[TCL_MINOR_OFFSET]++; |
| 677 | Th_ErrorMessage(interp, |
| 678 | "could not load Tcl shared library \"", fileName, -1); |
| 679 | return TH_ERROR; |
| 680 | #else |
| 681 | *pLibrary = 0; |
| 682 | *pxFindExecutable = Tcl_FindExecutable; |
| 683 | *pxCreateInterp = Tcl_CreateInterp; |
| 684 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -671,13 +671,14 @@ | |
| 671 | *pxCreateInterp = xCreateInterp; |
| 672 | *pxDeleteInterp = xDeleteInterp; |
| 673 | return TH_OK; |
| 674 | } |
| 675 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 676 | fileName[TCL_MINOR_OFFSET] = 'x'; |
| 677 | Th_ErrorMessage(interp, |
| 678 | "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"", |
| 679 | fileName, -1); |
| 680 | return TH_ERROR; |
| 681 | #else |
| 682 | *pLibrary = 0; |
| 683 | *pxFindExecutable = Tcl_FindExecutable; |
| 684 | *pxCreateInterp = Tcl_CreateInterp; |
| 685 |
+4
-6
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -230,13 +230,11 @@ | ||
| 230 | 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | 233 | */ |
| 234 | 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | - if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ | |
| 236 | - return 0; | |
| 237 | - }else{ | |
| 235 | + if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ | |
| 238 | 236 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 239 | 237 | if( !start->id ){ |
| 240 | 238 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 241 | 239 | "timer (#%d)", timerId); |
| 242 | 240 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | ||
| 244 | 242 | sqlite3_uint64 eu = 0, es = 0; |
| 245 | 243 | fossil_cpu_times( &eu, &es ); |
| 246 | 244 | return (eu - start->u) + (es - start->s); |
| 247 | 245 | } |
| 248 | 246 | } |
| 247 | + return 0; | |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | /* |
| 252 | 251 | ** Resets the timer associated with the given ID, as obtained via |
| 253 | 252 | ** fossil_timer_start(), to the current CPU time values. |
| 254 | 253 | */ |
| 255 | 254 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 256 | - if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ | |
| 257 | - return 0; | |
| 258 | - }else{ | |
| 255 | + if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ | |
| 259 | 256 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 260 | 257 | if( !start->id ){ |
| 261 | 258 | fossil_fatal("Invalid call to reset a non-allocated " |
| 262 | 259 | "timer (#%d)", timerId); |
| 263 | 260 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | ||
| 265 | 262 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 266 | 263 | fossil_cpu_times( &start->u, &start->s ); |
| 267 | 264 | return rc; |
| 268 | 265 | } |
| 269 | 266 | } |
| 267 | + return 0; | |
| 270 | 268 | } |
| 271 | 269 | |
| 272 | 270 | /** |
| 273 | 271 | "Deallocates" the fossil timer identified by the given timer ID. |
| 274 | 272 | returns the difference (in uSec) between the last time that timer |
| 275 | 273 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -230,13 +230,11 @@ | |
| 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | */ |
| 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 236 | return 0; |
| 237 | }else{ |
| 238 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 239 | if( !start->id ){ |
| 240 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 241 | "timer (#%d)", timerId); |
| 242 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | |
| 244 | sqlite3_uint64 eu = 0, es = 0; |
| 245 | fossil_cpu_times( &eu, &es ); |
| 246 | return (eu - start->u) + (es - start->s); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /* |
| 252 | ** Resets the timer associated with the given ID, as obtained via |
| 253 | ** fossil_timer_start(), to the current CPU time values. |
| 254 | */ |
| 255 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 256 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 257 | return 0; |
| 258 | }else{ |
| 259 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 260 | if( !start->id ){ |
| 261 | fossil_fatal("Invalid call to reset a non-allocated " |
| 262 | "timer (#%d)", timerId); |
| 263 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | |
| 265 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 266 | fossil_cpu_times( &start->u, &start->s ); |
| 267 | return rc; |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | "Deallocates" the fossil timer identified by the given timer ID. |
| 274 | returns the difference (in uSec) between the last time that timer |
| 275 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -230,13 +230,11 @@ | |
| 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | */ |
| 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ |
| 236 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 237 | if( !start->id ){ |
| 238 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 239 | "timer (#%d)", timerId); |
| 240 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | |
| 242 | sqlite3_uint64 eu = 0, es = 0; |
| 243 | fossil_cpu_times( &eu, &es ); |
| 244 | return (eu - start->u) + (es - start->s); |
| 245 | } |
| 246 | } |
| 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | /* |
| 251 | ** Resets the timer associated with the given ID, as obtained via |
| 252 | ** fossil_timer_start(), to the current CPU time values. |
| 253 | */ |
| 254 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 255 | if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ |
| 256 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 257 | if( !start->id ){ |
| 258 | fossil_fatal("Invalid call to reset a non-allocated " |
| 259 | "timer (#%d)", timerId); |
| 260 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | |
| 262 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 263 | fossil_cpu_times( &start->u, &start->s ); |
| 264 | return rc; |
| 265 | } |
| 266 | } |
| 267 | return 0; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | "Deallocates" the fossil timer identified by the given timer ID. |
| 272 | returns the difference (in uSec) between the last time that timer |
| 273 |
+4
-6
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -230,13 +230,11 @@ | ||
| 230 | 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | 233 | */ |
| 234 | 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | - if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ | |
| 236 | - return 0; | |
| 237 | - }else{ | |
| 235 | + if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ | |
| 238 | 236 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 239 | 237 | if( !start->id ){ |
| 240 | 238 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 241 | 239 | "timer (#%d)", timerId); |
| 242 | 240 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | ||
| 244 | 242 | sqlite3_uint64 eu = 0, es = 0; |
| 245 | 243 | fossil_cpu_times( &eu, &es ); |
| 246 | 244 | return (eu - start->u) + (es - start->s); |
| 247 | 245 | } |
| 248 | 246 | } |
| 247 | + return 0; | |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | /* |
| 252 | 251 | ** Resets the timer associated with the given ID, as obtained via |
| 253 | 252 | ** fossil_timer_start(), to the current CPU time values. |
| 254 | 253 | */ |
| 255 | 254 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 256 | - if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ | |
| 257 | - return 0; | |
| 258 | - }else{ | |
| 255 | + if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ | |
| 259 | 256 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 260 | 257 | if( !start->id ){ |
| 261 | 258 | fossil_fatal("Invalid call to reset a non-allocated " |
| 262 | 259 | "timer (#%d)", timerId); |
| 263 | 260 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | ||
| 265 | 262 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 266 | 263 | fossil_cpu_times( &start->u, &start->s ); |
| 267 | 264 | return rc; |
| 268 | 265 | } |
| 269 | 266 | } |
| 267 | + return 0; | |
| 270 | 268 | } |
| 271 | 269 | |
| 272 | 270 | /** |
| 273 | 271 | "Deallocates" the fossil timer identified by the given timer ID. |
| 274 | 272 | returns the difference (in uSec) between the last time that timer |
| 275 | 273 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -230,13 +230,11 @@ | |
| 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | */ |
| 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 236 | return 0; |
| 237 | }else{ |
| 238 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 239 | if( !start->id ){ |
| 240 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 241 | "timer (#%d)", timerId); |
| 242 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | |
| 244 | sqlite3_uint64 eu = 0, es = 0; |
| 245 | fossil_cpu_times( &eu, &es ); |
| 246 | return (eu - start->u) + (es - start->s); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /* |
| 252 | ** Resets the timer associated with the given ID, as obtained via |
| 253 | ** fossil_timer_start(), to the current CPU time values. |
| 254 | */ |
| 255 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 256 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 257 | return 0; |
| 258 | }else{ |
| 259 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 260 | if( !start->id ){ |
| 261 | fossil_fatal("Invalid call to reset a non-allocated " |
| 262 | "timer (#%d)", timerId); |
| 263 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | |
| 265 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 266 | fossil_cpu_times( &start->u, &start->s ); |
| 267 | return rc; |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | "Deallocates" the fossil timer identified by the given timer ID. |
| 274 | returns the difference (in uSec) between the last time that timer |
| 275 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -230,13 +230,11 @@ | |
| 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | */ |
| 234 | sqlite3_uint64 fossil_timer_fetch(int timerId){ |
| 235 | if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ |
| 236 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 237 | if( !start->id ){ |
| 238 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 239 | "timer (#%d)", timerId); |
| 240 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | |
| 242 | sqlite3_uint64 eu = 0, es = 0; |
| 243 | fossil_cpu_times( &eu, &es ); |
| 244 | return (eu - start->u) + (es - start->s); |
| 245 | } |
| 246 | } |
| 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | /* |
| 251 | ** Resets the timer associated with the given ID, as obtained via |
| 252 | ** fossil_timer_start(), to the current CPU time values. |
| 253 | */ |
| 254 | sqlite3_uint64 fossil_timer_reset(int timerId){ |
| 255 | if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){ |
| 256 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 257 | if( !start->id ){ |
| 258 | fossil_fatal("Invalid call to reset a non-allocated " |
| 259 | "timer (#%d)", timerId); |
| 260 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | |
| 262 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 263 | fossil_cpu_times( &start->u, &start->s ); |
| 264 | return rc; |
| 265 | } |
| 266 | } |
| 267 | return 0; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | "Deallocates" the fossil timer identified by the given timer ID. |
| 272 | returns the difference (in uSec) between the last time that timer |
| 273 |