Check-in [dea1ae50d3]
Not logged in
Overview

SHA1 Hash:dea1ae50d3f9d7e76de5aa2fe93bb80e08af4aa0
Date: 2007-09-23 11:43:40
User: drh
Comment: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.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/manifest.c from [1d87ff81d3] to [a851f31798].

@@ -100,11 +100,11 @@
 int manifest_parse(Manifest *p, Blob *pContent){
   int seenHeader = 0;
   int i;
   Blob line, token, a1, a2, a3;
   Blob selfuuid;
-  char zPrevLine[10];
+  char cPrevType = 0;
 
   memset(p, 0, sizeof(*p));
   memcpy(&p->content, pContent, sizeof(p->content));
   sha1sum_blob(&p->content, &selfuuid);
   memcpy(p->zUuid, blob_buffer(&selfuuid), UUID_SIZE);
@@ -113,11 +113,10 @@
   pContent = &p->content;
 
   blob_zero(&a1);
   blob_zero(&a2);
   md5sum_init();
-  zPrevLine[0] = 0;
   while( blob_line(pContent, &line) ){
     char *z = blob_buffer(&line);
     if( z[0]=='-' ){
       if( strncmp(z, "-----BEGIN PGP ", 15)!=0 ){
         goto manifest_syntax_error;
@@ -127,15 +126,15 @@
       }
       while( blob_line(pContent, &line)>2 ){}
       if( blob_line(pContent, &line)==0 ) break;
       z = blob_buffer(&line);
     }
-    if( strcmp(z, zPrevLine)<0 ){
+    if( z[0]<cPrevType ){
       /* Lines of a manifest must occur in lexicographical order */
       goto manifest_syntax_error;
     }
-    sqlite3_snprintf(sizeof(zPrevLine), zPrevLine, "%s", z);
+    cPrevType = z[0];
     seenHeader = 1;
     if( blob_token(&line, &token)!=1 ) goto manifest_syntax_error;
     switch( z[0] ){
       /*
       **     C <comment>