Fossil SCM

Relax the lexigraphical ordering requirement on manifests. Now the lines of a manifest (or cluster or control file) must occur in lexigraphical order after the arguments have been defossilized.

drh 2007-09-23 11:43 trunk
Commit dea1ae50d3f9d7e76de5aa2fe93bb80e08af4aa0
1 file changed +3 -4
+3 -4
--- src/manifest.c
+++ src/manifest.c
@@ -100,11 +100,11 @@
100100
int manifest_parse(Manifest *p, Blob *pContent){
101101
int seenHeader = 0;
102102
int i;
103103
Blob line, token, a1, a2, a3;
104104
Blob selfuuid;
105
- char zPrevLine[10];
105
+ char cPrevType = 0;
106106
107107
memset(p, 0, sizeof(*p));
108108
memcpy(&p->content, pContent, sizeof(p->content));
109109
sha1sum_blob(&p->content, &selfuuid);
110110
memcpy(p->zUuid, blob_buffer(&selfuuid), UUID_SIZE);
@@ -113,11 +113,10 @@
113113
pContent = &p->content;
114114
115115
blob_zero(&a1);
116116
blob_zero(&a2);
117117
md5sum_init();
118
- zPrevLine[0] = 0;
119118
while( blob_line(pContent, &line) ){
120119
char *z = blob_buffer(&line);
121120
if( z[0]=='-' ){
122121
if( strncmp(z, "-----BEGIN PGP ", 15)!=0 ){
123122
goto manifest_syntax_error;
@@ -127,15 +126,15 @@
127126
}
128127
while( blob_line(pContent, &line)>2 ){}
129128
if( blob_line(pContent, &line)==0 ) break;
130129
z = blob_buffer(&line);
131130
}
132
- if( strcmp(z, zPrevLine)<0 ){
131
+ if( z[0]<cPrevType ){
133132
/* Lines of a manifest must occur in lexicographical order */
134133
goto manifest_syntax_error;
135134
}
136
- sqlite3_snprintf(sizeof(zPrevLine), zPrevLine, "%s", z);
135
+ cPrevType = z[0];
137136
seenHeader = 1;
138137
if( blob_token(&line, &token)!=1 ) goto manifest_syntax_error;
139138
switch( z[0] ){
140139
/*
141140
** C <comment>
142141
--- src/manifest.c
+++ src/manifest.c
@@ -100,11 +100,11 @@
100 int manifest_parse(Manifest *p, Blob *pContent){
101 int seenHeader = 0;
102 int i;
103 Blob line, token, a1, a2, a3;
104 Blob selfuuid;
105 char zPrevLine[10];
106
107 memset(p, 0, sizeof(*p));
108 memcpy(&p->content, pContent, sizeof(p->content));
109 sha1sum_blob(&p->content, &selfuuid);
110 memcpy(p->zUuid, blob_buffer(&selfuuid), UUID_SIZE);
@@ -113,11 +113,10 @@
113 pContent = &p->content;
114
115 blob_zero(&a1);
116 blob_zero(&a2);
117 md5sum_init();
118 zPrevLine[0] = 0;
119 while( blob_line(pContent, &line) ){
120 char *z = blob_buffer(&line);
121 if( z[0]=='-' ){
122 if( strncmp(z, "-----BEGIN PGP ", 15)!=0 ){
123 goto manifest_syntax_error;
@@ -127,15 +126,15 @@
127 }
128 while( blob_line(pContent, &line)>2 ){}
129 if( blob_line(pContent, &line)==0 ) break;
130 z = blob_buffer(&line);
131 }
132 if( strcmp(z, zPrevLine)<0 ){
133 /* Lines of a manifest must occur in lexicographical order */
134 goto manifest_syntax_error;
135 }
136 sqlite3_snprintf(sizeof(zPrevLine), zPrevLine, "%s", z);
137 seenHeader = 1;
138 if( blob_token(&line, &token)!=1 ) goto manifest_syntax_error;
139 switch( z[0] ){
140 /*
141 ** C <comment>
142
--- src/manifest.c
+++ src/manifest.c
@@ -100,11 +100,11 @@
100 int manifest_parse(Manifest *p, Blob *pContent){
101 int seenHeader = 0;
102 int i;
103 Blob line, token, a1, a2, a3;
104 Blob selfuuid;
105 char cPrevType = 0;
106
107 memset(p, 0, sizeof(*p));
108 memcpy(&p->content, pContent, sizeof(p->content));
109 sha1sum_blob(&p->content, &selfuuid);
110 memcpy(p->zUuid, blob_buffer(&selfuuid), UUID_SIZE);
@@ -113,11 +113,10 @@
113 pContent = &p->content;
114
115 blob_zero(&a1);
116 blob_zero(&a2);
117 md5sum_init();
 
118 while( blob_line(pContent, &line) ){
119 char *z = blob_buffer(&line);
120 if( z[0]=='-' ){
121 if( strncmp(z, "-----BEGIN PGP ", 15)!=0 ){
122 goto manifest_syntax_error;
@@ -127,15 +126,15 @@
126 }
127 while( blob_line(pContent, &line)>2 ){}
128 if( blob_line(pContent, &line)==0 ) break;
129 z = blob_buffer(&line);
130 }
131 if( z[0]<cPrevType ){
132 /* Lines of a manifest must occur in lexicographical order */
133 goto manifest_syntax_error;
134 }
135 cPrevType = z[0];
136 seenHeader = 1;
137 if( blob_token(&line, &token)!=1 ) goto manifest_syntax_error;
138 switch( z[0] ){
139 /*
140 ** C <comment>
141

Keyboard Shortcuts

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