Fossil SCM
Cluster artifacts with Q-card are invalid. Check for "cluster" artifacts first so all later code-paths can leave out the M-card check. Check for K-cards in the "ticket" section, so all later code-paths can leave out this check. Check for L-cards in the "wiki" section, so all later code-paths can leave out this check. This saves 9 code-lines while keeping equal functionality (except for the additional Q-card check in Clusters)
Commit
13e2c73aec7fa125b64ee421824951f171c36ace
Parent
09c2cf3e585ae2b…
1 file changed
+27
-36
+27
-36
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -852,99 +852,90 @@ | ||
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | if( x.z<x.zEnd ) SYNTAX("extra characters at end of card"); |
| 856 | 856 | |
| 857 | - if( p->nFile>0 || p->zRepoCksum!=0 || p->zBaseline ){ | |
| 858 | - if( p->nCChild>0 ) SYNTAX("M-card in check-in"); | |
| 857 | + if( p->nCChild>0 ){ | |
| 858 | + if( p->zAttachName | |
| 859 | + || p->zBaseline | |
| 860 | + || p->zComment | |
| 861 | + || p->rDate>0.0 | |
| 862 | + || p->zEventId | |
| 863 | + || p->nFile>0 | |
| 864 | + || p->nField>0 | |
| 865 | + || p->zTicketUuid | |
| 866 | + || p->zWikiTitle | |
| 867 | + || p->zMimetype | |
| 868 | + || p->nParent>0 | |
| 869 | + || p->nCherrypick>0 | |
| 870 | + || p->zRepoCksum | |
| 871 | + || p->nTag>0 | |
| 872 | + || p->zUser | |
| 873 | + || p->zWiki | |
| 874 | + ){ | |
| 875 | + SYNTAX("cluster contains a card other than M- or Z-"); | |
| 876 | + } | |
| 877 | + if( !seenZ ) SYNTAX("missing Z-card on cluster"); | |
| 878 | + p->type = CFTYPE_CLUSTER; | |
| 879 | + }else if( p->nFile>0 || p->zRepoCksum!=0 || p->zBaseline ){ | |
| 859 | 880 | if( p->rDate<=0.0 ) SYNTAX("missing date for check-in"); |
| 860 | 881 | if( p->nField>0 ) SYNTAX("J-card in check-in"); |
| 861 | 882 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 862 | 883 | if( p->zWiki ) SYNTAX("W-card in check-in"); |
| 863 | 884 | if( p->zWikiTitle ) SYNTAX("L-card in check-in"); |
| 864 | 885 | if( p->zEventId ) SYNTAX("E-card in check-in"); |
| 865 | 886 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 866 | 887 | if( p->zAttachName ) SYNTAX("A-card in check-in"); |
| 867 | 888 | p->type = CFTYPE_MANIFEST; |
| 868 | - }else if( p->nCChild>0 ){ | |
| 869 | - if( p->rDate>0.0 | |
| 870 | - || p->zComment!=0 | |
| 871 | - || p->zUser!=0 | |
| 872 | - || p->nTag>0 | |
| 873 | - || p->nParent>0 | |
| 874 | - || p->nField>0 | |
| 875 | - || p->zTicketUuid | |
| 876 | - || p->zWiki | |
| 877 | - || p->zWikiTitle | |
| 878 | - || p->zEventId | |
| 879 | - || p->zAttachName | |
| 880 | - || p->zMimetype | |
| 881 | - ){ | |
| 882 | - SYNTAX("cluster contains a card other than M- or Z-"); | |
| 883 | - } | |
| 884 | - if( !seenZ ) SYNTAX("missing Z-card on cluster"); | |
| 885 | - p->type = CFTYPE_CLUSTER; | |
| 886 | - }else if( p->nField>0 ){ | |
| 889 | + }else if( p->nField>0 || p->zTicketUuid!=0 ){ | |
| 887 | 890 | if( p->rDate<=0.0 ) SYNTAX("missing date for ticket"); |
| 888 | 891 | if( p->zWiki ) SYNTAX("W-card in ticket"); |
| 889 | 892 | if( p->zWikiTitle ) SYNTAX("L-card in ticket"); |
| 890 | 893 | if( p->zEventId ) SYNTAX("E-card in ticket"); |
| 891 | - if( p->nCChild>0 ) SYNTAX("M-card in ticket"); | |
| 894 | + if( p->nField==0 ) SYNTAX("missing J-card in ticket"); | |
| 892 | 895 | if( p->nTag>0 ) SYNTAX("T-card in ticket"); |
| 893 | 896 | if( p->zTicketUuid==0 ) SYNTAX("missing K-card in ticket"); |
| 894 | 897 | if( p->zUser==0 ) SYNTAX("missing U-card in ticket"); |
| 895 | 898 | if( p->zAttachName ) SYNTAX("A-card in ticket"); |
| 896 | 899 | if( p->zMimetype) SYNTAX("N-card in ticket"); |
| 897 | 900 | if( !seenZ ) SYNTAX("missing Z-card in ticket"); |
| 898 | 901 | p->type = CFTYPE_TICKET; |
| 899 | 902 | }else if( p->zEventId ){ |
| 900 | 903 | if( p->rDate<=0.0 ) SYNTAX("missing date for event"); |
| 901 | - if( p->nCChild>0 ) SYNTAX("M-card in event"); | |
| 902 | - if( p->zTicketUuid!=0 ) SYNTAX("K-card in event"); | |
| 903 | 904 | if( p->zWikiTitle!=0 ) SYNTAX("L-card in event"); |
| 904 | 905 | if( p->zWiki==0 ) SYNTAX("W-card in event"); |
| 905 | 906 | if( p->zAttachName ) SYNTAX("A-card in event"); |
| 906 | 907 | for(i=0; i<p->nTag; i++){ |
| 907 | 908 | if( p->aTag[i].zName[0]!='+' ) SYNTAX("propagating tag in event"); |
| 908 | 909 | if( p->aTag[i].zUuid!=0 ) SYNTAX("non-self-referential tag in event"); |
| 909 | 910 | } |
| 910 | 911 | if( !seenZ ) SYNTAX("Z-card missing in event"); |
| 911 | 912 | p->type = CFTYPE_EVENT; |
| 912 | - }else if( p->zWiki!=0 ){ | |
| 913 | + }else if( p->zWiki!=0 || p->zWikiTitle!=0 ){ | |
| 913 | 914 | if( p->rDate<=0.0 ) SYNTAX("date missing on wiki"); |
| 914 | - if( p->nCChild>0 ) SYNTAX("M-card in wiki"); | |
| 915 | 915 | if( p->nTag>0 ) SYNTAX("T-card in wiki"); |
| 916 | - if( p->zTicketUuid!=0 ) SYNTAX("K-card in wiki"); | |
| 916 | + if( p->zWiki==0 ) SYNTAX("missing W-card in wiki"); | |
| 917 | 917 | if( p->zWikiTitle==0 ) SYNTAX("L-card in wiki"); |
| 918 | 918 | if( p->zAttachName ) SYNTAX("A-card in wiki"); |
| 919 | 919 | if( !seenZ ) SYNTAX("missing Z-card on wiki"); |
| 920 | 920 | p->type = CFTYPE_WIKI; |
| 921 | 921 | }else if( p->nTag>0 ){ |
| 922 | 922 | if( p->rDate<=0.0 ) SYNTAX("date missing on tag"); |
| 923 | 923 | if( p->nParent>0 ) SYNTAX("P-card on tag"); |
| 924 | - if( p->zWikiTitle ) SYNTAX("L-card on tag"); | |
| 925 | - if( p->zTicketUuid ) SYNTAX("K-card in tag"); | |
| 926 | 924 | if( p->zAttachName ) SYNTAX("A-card in tag"); |
| 927 | 925 | if( p->zMimetype ) SYNTAX("N-card in tag"); |
| 928 | 926 | if( !seenZ ) SYNTAX("missing Z-card on tag"); |
| 929 | 927 | for(i=0; i<p->nTag; i++){ |
| 930 | 928 | if( p->aTag[i].zUuid==0 ) SYNTAX("self-referential T-card in tag"); |
| 931 | 929 | } |
| 932 | 930 | p->type = CFTYPE_CONTROL; |
| 933 | 931 | }else if( p->zAttachName ){ |
| 934 | - if( p->nCChild>0 ) SYNTAX("M-card in attachment"); | |
| 935 | 932 | if( p->rDate<=0.0 ) SYNTAX("missing date in attachment"); |
| 936 | - if( p->zTicketUuid ) SYNTAX("K-card in attachment"); | |
| 937 | - if( p->zWikiTitle ) SYNTAX("L-card in attachment"); | |
| 938 | 933 | if( !seenZ ) SYNTAX("missing Z-card on attachment"); |
| 939 | 934 | p->type = CFTYPE_ATTACHMENT; |
| 940 | 935 | }else{ |
| 941 | - if( p->nCChild>0 ) SYNTAX("M-card in check-in"); | |
| 942 | 936 | if( p->rDate<=0.0 ) SYNTAX("missing date in check-in"); |
| 943 | - if( p->nField>0 ) SYNTAX("J-card in check-in"); | |
| 944 | - if( p->zTicketUuid ) SYNTAX("K-card in check-in"); | |
| 945 | - if( p->zWikiTitle ) SYNTAX("L-card in check-in"); | |
| 946 | 937 | p->type = CFTYPE_MANIFEST; |
| 947 | 938 | } |
| 948 | 939 | md5sum_init(); |
| 949 | 940 | if( !isRepeat ) g.parseCnt[p->type]++; |
| 950 | 941 | return p; |
| 951 | 942 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -852,99 +852,90 @@ | |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | if( x.z<x.zEnd ) SYNTAX("extra characters at end of card"); |
| 856 | |
| 857 | if( p->nFile>0 || p->zRepoCksum!=0 || p->zBaseline ){ |
| 858 | if( p->nCChild>0 ) SYNTAX("M-card in check-in"); |
| 859 | if( p->rDate<=0.0 ) SYNTAX("missing date for check-in"); |
| 860 | if( p->nField>0 ) SYNTAX("J-card in check-in"); |
| 861 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 862 | if( p->zWiki ) SYNTAX("W-card in check-in"); |
| 863 | if( p->zWikiTitle ) SYNTAX("L-card in check-in"); |
| 864 | if( p->zEventId ) SYNTAX("E-card in check-in"); |
| 865 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 866 | if( p->zAttachName ) SYNTAX("A-card in check-in"); |
| 867 | p->type = CFTYPE_MANIFEST; |
| 868 | }else if( p->nCChild>0 ){ |
| 869 | if( p->rDate>0.0 |
| 870 | || p->zComment!=0 |
| 871 | || p->zUser!=0 |
| 872 | || p->nTag>0 |
| 873 | || p->nParent>0 |
| 874 | || p->nField>0 |
| 875 | || p->zTicketUuid |
| 876 | || p->zWiki |
| 877 | || p->zWikiTitle |
| 878 | || p->zEventId |
| 879 | || p->zAttachName |
| 880 | || p->zMimetype |
| 881 | ){ |
| 882 | SYNTAX("cluster contains a card other than M- or Z-"); |
| 883 | } |
| 884 | if( !seenZ ) SYNTAX("missing Z-card on cluster"); |
| 885 | p->type = CFTYPE_CLUSTER; |
| 886 | }else if( p->nField>0 ){ |
| 887 | if( p->rDate<=0.0 ) SYNTAX("missing date for ticket"); |
| 888 | if( p->zWiki ) SYNTAX("W-card in ticket"); |
| 889 | if( p->zWikiTitle ) SYNTAX("L-card in ticket"); |
| 890 | if( p->zEventId ) SYNTAX("E-card in ticket"); |
| 891 | if( p->nCChild>0 ) SYNTAX("M-card in ticket"); |
| 892 | if( p->nTag>0 ) SYNTAX("T-card in ticket"); |
| 893 | if( p->zTicketUuid==0 ) SYNTAX("missing K-card in ticket"); |
| 894 | if( p->zUser==0 ) SYNTAX("missing U-card in ticket"); |
| 895 | if( p->zAttachName ) SYNTAX("A-card in ticket"); |
| 896 | if( p->zMimetype) SYNTAX("N-card in ticket"); |
| 897 | if( !seenZ ) SYNTAX("missing Z-card in ticket"); |
| 898 | p->type = CFTYPE_TICKET; |
| 899 | }else if( p->zEventId ){ |
| 900 | if( p->rDate<=0.0 ) SYNTAX("missing date for event"); |
| 901 | if( p->nCChild>0 ) SYNTAX("M-card in event"); |
| 902 | if( p->zTicketUuid!=0 ) SYNTAX("K-card in event"); |
| 903 | if( p->zWikiTitle!=0 ) SYNTAX("L-card in event"); |
| 904 | if( p->zWiki==0 ) SYNTAX("W-card in event"); |
| 905 | if( p->zAttachName ) SYNTAX("A-card in event"); |
| 906 | for(i=0; i<p->nTag; i++){ |
| 907 | if( p->aTag[i].zName[0]!='+' ) SYNTAX("propagating tag in event"); |
| 908 | if( p->aTag[i].zUuid!=0 ) SYNTAX("non-self-referential tag in event"); |
| 909 | } |
| 910 | if( !seenZ ) SYNTAX("Z-card missing in event"); |
| 911 | p->type = CFTYPE_EVENT; |
| 912 | }else if( p->zWiki!=0 ){ |
| 913 | if( p->rDate<=0.0 ) SYNTAX("date missing on wiki"); |
| 914 | if( p->nCChild>0 ) SYNTAX("M-card in wiki"); |
| 915 | if( p->nTag>0 ) SYNTAX("T-card in wiki"); |
| 916 | if( p->zTicketUuid!=0 ) SYNTAX("K-card in wiki"); |
| 917 | if( p->zWikiTitle==0 ) SYNTAX("L-card in wiki"); |
| 918 | if( p->zAttachName ) SYNTAX("A-card in wiki"); |
| 919 | if( !seenZ ) SYNTAX("missing Z-card on wiki"); |
| 920 | p->type = CFTYPE_WIKI; |
| 921 | }else if( p->nTag>0 ){ |
| 922 | if( p->rDate<=0.0 ) SYNTAX("date missing on tag"); |
| 923 | if( p->nParent>0 ) SYNTAX("P-card on tag"); |
| 924 | if( p->zWikiTitle ) SYNTAX("L-card on tag"); |
| 925 | if( p->zTicketUuid ) SYNTAX("K-card in tag"); |
| 926 | if( p->zAttachName ) SYNTAX("A-card in tag"); |
| 927 | if( p->zMimetype ) SYNTAX("N-card in tag"); |
| 928 | if( !seenZ ) SYNTAX("missing Z-card on tag"); |
| 929 | for(i=0; i<p->nTag; i++){ |
| 930 | if( p->aTag[i].zUuid==0 ) SYNTAX("self-referential T-card in tag"); |
| 931 | } |
| 932 | p->type = CFTYPE_CONTROL; |
| 933 | }else if( p->zAttachName ){ |
| 934 | if( p->nCChild>0 ) SYNTAX("M-card in attachment"); |
| 935 | if( p->rDate<=0.0 ) SYNTAX("missing date in attachment"); |
| 936 | if( p->zTicketUuid ) SYNTAX("K-card in attachment"); |
| 937 | if( p->zWikiTitle ) SYNTAX("L-card in attachment"); |
| 938 | if( !seenZ ) SYNTAX("missing Z-card on attachment"); |
| 939 | p->type = CFTYPE_ATTACHMENT; |
| 940 | }else{ |
| 941 | if( p->nCChild>0 ) SYNTAX("M-card in check-in"); |
| 942 | if( p->rDate<=0.0 ) SYNTAX("missing date in check-in"); |
| 943 | if( p->nField>0 ) SYNTAX("J-card in check-in"); |
| 944 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 945 | if( p->zWikiTitle ) SYNTAX("L-card in check-in"); |
| 946 | p->type = CFTYPE_MANIFEST; |
| 947 | } |
| 948 | md5sum_init(); |
| 949 | if( !isRepeat ) g.parseCnt[p->type]++; |
| 950 | return p; |
| 951 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -852,99 +852,90 @@ | |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | if( x.z<x.zEnd ) SYNTAX("extra characters at end of card"); |
| 856 | |
| 857 | if( p->nCChild>0 ){ |
| 858 | if( p->zAttachName |
| 859 | || p->zBaseline |
| 860 | || p->zComment |
| 861 | || p->rDate>0.0 |
| 862 | || p->zEventId |
| 863 | || p->nFile>0 |
| 864 | || p->nField>0 |
| 865 | || p->zTicketUuid |
| 866 | || p->zWikiTitle |
| 867 | || p->zMimetype |
| 868 | || p->nParent>0 |
| 869 | || p->nCherrypick>0 |
| 870 | || p->zRepoCksum |
| 871 | || p->nTag>0 |
| 872 | || p->zUser |
| 873 | || p->zWiki |
| 874 | ){ |
| 875 | SYNTAX("cluster contains a card other than M- or Z-"); |
| 876 | } |
| 877 | if( !seenZ ) SYNTAX("missing Z-card on cluster"); |
| 878 | p->type = CFTYPE_CLUSTER; |
| 879 | }else if( p->nFile>0 || p->zRepoCksum!=0 || p->zBaseline ){ |
| 880 | if( p->rDate<=0.0 ) SYNTAX("missing date for check-in"); |
| 881 | if( p->nField>0 ) SYNTAX("J-card in check-in"); |
| 882 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 883 | if( p->zWiki ) SYNTAX("W-card in check-in"); |
| 884 | if( p->zWikiTitle ) SYNTAX("L-card in check-in"); |
| 885 | if( p->zEventId ) SYNTAX("E-card in check-in"); |
| 886 | if( p->zTicketUuid ) SYNTAX("K-card in check-in"); |
| 887 | if( p->zAttachName ) SYNTAX("A-card in check-in"); |
| 888 | p->type = CFTYPE_MANIFEST; |
| 889 | }else if( p->nField>0 || p->zTicketUuid!=0 ){ |
| 890 | if( p->rDate<=0.0 ) SYNTAX("missing date for ticket"); |
| 891 | if( p->zWiki ) SYNTAX("W-card in ticket"); |
| 892 | if( p->zWikiTitle ) SYNTAX("L-card in ticket"); |
| 893 | if( p->zEventId ) SYNTAX("E-card in ticket"); |
| 894 | if( p->nField==0 ) SYNTAX("missing J-card in ticket"); |
| 895 | if( p->nTag>0 ) SYNTAX("T-card in ticket"); |
| 896 | if( p->zTicketUuid==0 ) SYNTAX("missing K-card in ticket"); |
| 897 | if( p->zUser==0 ) SYNTAX("missing U-card in ticket"); |
| 898 | if( p->zAttachName ) SYNTAX("A-card in ticket"); |
| 899 | if( p->zMimetype) SYNTAX("N-card in ticket"); |
| 900 | if( !seenZ ) SYNTAX("missing Z-card in ticket"); |
| 901 | p->type = CFTYPE_TICKET; |
| 902 | }else if( p->zEventId ){ |
| 903 | if( p->rDate<=0.0 ) SYNTAX("missing date for event"); |
| 904 | if( p->zWikiTitle!=0 ) SYNTAX("L-card in event"); |
| 905 | if( p->zWiki==0 ) SYNTAX("W-card in event"); |
| 906 | if( p->zAttachName ) SYNTAX("A-card in event"); |
| 907 | for(i=0; i<p->nTag; i++){ |
| 908 | if( p->aTag[i].zName[0]!='+' ) SYNTAX("propagating tag in event"); |
| 909 | if( p->aTag[i].zUuid!=0 ) SYNTAX("non-self-referential tag in event"); |
| 910 | } |
| 911 | if( !seenZ ) SYNTAX("Z-card missing in event"); |
| 912 | p->type = CFTYPE_EVENT; |
| 913 | }else if( p->zWiki!=0 || p->zWikiTitle!=0 ){ |
| 914 | if( p->rDate<=0.0 ) SYNTAX("date missing on wiki"); |
| 915 | if( p->nTag>0 ) SYNTAX("T-card in wiki"); |
| 916 | if( p->zWiki==0 ) SYNTAX("missing W-card in wiki"); |
| 917 | if( p->zWikiTitle==0 ) SYNTAX("L-card in wiki"); |
| 918 | if( p->zAttachName ) SYNTAX("A-card in wiki"); |
| 919 | if( !seenZ ) SYNTAX("missing Z-card on wiki"); |
| 920 | p->type = CFTYPE_WIKI; |
| 921 | }else if( p->nTag>0 ){ |
| 922 | if( p->rDate<=0.0 ) SYNTAX("date missing on tag"); |
| 923 | if( p->nParent>0 ) SYNTAX("P-card on tag"); |
| 924 | if( p->zAttachName ) SYNTAX("A-card in tag"); |
| 925 | if( p->zMimetype ) SYNTAX("N-card in tag"); |
| 926 | if( !seenZ ) SYNTAX("missing Z-card on tag"); |
| 927 | for(i=0; i<p->nTag; i++){ |
| 928 | if( p->aTag[i].zUuid==0 ) SYNTAX("self-referential T-card in tag"); |
| 929 | } |
| 930 | p->type = CFTYPE_CONTROL; |
| 931 | }else if( p->zAttachName ){ |
| 932 | if( p->rDate<=0.0 ) SYNTAX("missing date in attachment"); |
| 933 | if( !seenZ ) SYNTAX("missing Z-card on attachment"); |
| 934 | p->type = CFTYPE_ATTACHMENT; |
| 935 | }else{ |
| 936 | if( p->rDate<=0.0 ) SYNTAX("missing date in check-in"); |
| 937 | p->type = CFTYPE_MANIFEST; |
| 938 | } |
| 939 | md5sum_init(); |
| 940 | if( !isRepeat ) g.parseCnt[p->type]++; |
| 941 | return p; |
| 942 |