Overview
SHA1 Hash: | e81cc91aa4024898fa44492779e6b94396922337 |
---|---|
Date: | 2008-02-04 14:24:28 |
User: | drh |
Comment: | Additional cleanup in the differencing engine. The new "dir" webpage now uses name= instead of the d= for the query parameter. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/browse.c from [726cbbaa6f] to [6e4217591a].
@@ -71,14 +71,14 @@ /* ** WEBPAGE: dir ** ** Query parameters: ** -** d=PATH Directory to display. Required. +** name=PATH Directory to display. Required. */ void page_dir(void){ - const char *zD = P("d"); + const char *zD = P("name"); int mxLen; int nCol, nRow; int cnt, i; char *zPrefix; Stmt q; @@ -87,11 +87,11 @@ if( !g.okHistory ){ login_needed(); return; } style_header("File List"); sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, pathelementFunc, 0, 0); - /* If the d= parameter is an empty string, make it a NULL pointer */ + /* If the name= parameter is an empty string, make it a NULL pointer */ if( zD && strlen(zD)==0 ){ zD = 0; } /* Compute the title of the page */ if( zD ){ int i, j; @@ -106,11 +106,11 @@ ); for(i=0; zD[i]; i=j){ for(j=i; zD[j] && zD[j]!='/'; j++){} if( zD[j] ){ zCopy[j] = 0; - blob_appendf(&title, "/<a href=\"%s/dir?d=%T\">%h</a>", + blob_appendf(&title, "/<a href=\"%s/dir?name=%T\">%h</a>", g.zBaseURL, zCopy, &zCopy[i]); zCopy[j] = '/'; }else{ blob_appendf(&title, "/%h", &zCopy[i]); } @@ -165,11 +165,11 @@ } i++; zFName = db_column_text(&q, 0); if( zFName[0]=='/' ){ zFName++; - @ <li><a href="%s(g.zBaseURL)/dir?d=%T(zPrefix)%T(zFName)"> + @ <li><a href="%s(g.zBaseURL)/dir?name=%T(zPrefix)%T(zFName)"> @ %h(zFName)/</a></li> }else{ @ <li><a href="%s(g.zBaseURL)/finfo?name=%T(zPrefix)%T(zFName)"> @ %h(zFName)</a></li> }
Modified src/diff.c from [7a0eb09931] to [06ee9b8f1e].
@@ -27,40 +27,34 @@ #include "config.h" #include "diff.h" #include <assert.h> -#if 0 -#define DEBUG(X) X -#else -#define DEBUG(X) -#endif +/* +** Maximum length of a line in a text file. (8192) +*/ +#define LENGTH_MASK_SZ 13 +#define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) /* ** Information about each line of a file being diffed. ** -** The lower 20 bits of the hash are the length of the -** line. If any line is longer than 1048575 characters, +** The lower LENGTH_MASK_SZ bits of the hash (DLine.h) are the length +** of the line. If any line is longer than LENGTH_MASK characters, ** the file is considered binary. */ typedef struct DLine DLine; struct DLine { const char *z; /* The text of the line */ unsigned int h; /* Hash of the line */ - unsigned int iNext; /* Index+1 of next line with same the same hash */ + unsigned int iNext; /* 1+(Index of next line with same the same hash) */ /* an array of DLine elements services two purposes. The fields ** above are one per line of input text. But each entry is also - ** a bucket in a hash table. */ - unsigned int iHash; /* First entry+1 in the hash array */ -}; - -/* -** Maximum length of a line in a text file. (8192) -*/ -#define LENGTH_MASK_SZ 13 -#define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) + ** a bucket in a hash table, as follows: */ + unsigned int iHash; /* 1+(first entry in the hash chain) */ +}; /* ** A context for running a diff. */ typedef struct DContext DContext; @@ -82,11 +76,11 @@ ** Trailing whitespace is removed from each line. ** ** Return 0 if the file is binary or contains a line that is ** too long. */ -static DLine *break_into_lines(char *z, int *pnLine){ +static DLine *break_into_lines(const char *z, int *pnLine){ int nLine, i, j, k, x; unsigned int h, h2; DLine *a; /* Count the number of lines. Allocate space to hold @@ -221,11 +215,11 @@ mxr = p->nEdit; if( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; } for(r=0; r<mxr; r += 3*nr){ /* Figure out how many triples to show in a single block */ for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<nContext*2; nr++){} - DEBUG( printf("r=%d nr=%d\n", r, nr); ) + /* printf("r=%d nr=%d\n", r, nr); */ /* For the current block comprising nr triples, figure out ** how many lines of A and B are to be displayed */ if( R[r]>nContext ){