Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Redo the enhancement of check-in [1e881f59786bd891] in a way that is portable to legacy systems. The strnlen() function is now always available. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
1a84fe09c7a09db713e53746d2527eeb |
| User & Date: | drh 2020-02-25 15:58:05.661 |
Context
|
2020-02-25
| ||
| 15:59 | Improved diff performance by using a 64-bit hash. Now able to diff files with lines up to 32KiB in length. check-in: ce0bce90cf user: drh tags: trunk | |
| 15:58 | Redo the enhancement of check-in [1e881f59786bd891] in a way that is portable to legacy systems. The strnlen() function is now always available. check-in: 1a84fe09c7 user: drh tags: trunk | |
| 11:56 | Change the sense of the "same_dline()" routine in the diff generator so that it returns 0 if the lines are the same and non-zero if the lines are different, as this helps the diff logic to run faster. check-in: 2f7527e88c user: drh tags: trunk | |
Changes
Changes to src/printf.c.
| ︙ | ︙ | |||
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | } /* ** Size of temporary conversion buffer. */ #define etBUFSIZE 500 /* ** Return an appropriate set of flags for wiki_convert() for displaying ** comments on a timeline. These flag settings are determined by ** configuration parameters. ** ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2 ** flags) and is false for plain "%W". The ! indicates that the text is | > > > > > > > > > > > > > > > > | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
}
/*
** Size of temporary conversion buffer.
*/
#define etBUFSIZE 500
/*
** Find the length of a string as long as that length does not
** exceed N bytes. If no zero terminator is seen in the first
** N bytes then return N. If N is negative, then this routine
** is an alias for strlen().
*/
#if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
# define StrNLen32(Z,N) (int)strnlen(Z,N)
#else
static int StrNLen32(const char *z, int N){
int n = 0;
while( (N-- != 0) && *(z++)!=0 ){ n++; }
return n;
}
#endif
/*
** Return an appropriate set of flags for wiki_convert() for displaying
** comments on a timeline. These flag settings are determined by
** configuration parameters.
**
** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
** flags) and is false for plain "%W". The ! indicates that the text is
|
| ︙ | ︙ | |||
638 639 640 641 642 643 644 |
bufpt = buf;
break;
case etPATH: {
int i;
int limit = flag_alternateform ? va_arg(ap,int) : -1;
char *e = va_arg(ap,char*);
if( e==0 ){e="";}
| | | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
bufpt = buf;
break;
case etPATH: {
int i;
int limit = flag_alternateform ? va_arg(ap,int) : -1;
char *e = va_arg(ap,char*);
if( e==0 ){e="";}
length = StrNLen32(e, limit);
zExtra = bufpt = fossil_malloc(length+1);
for( i=0; i<length; i++ ){
if( e[i]=='\\' ){
bufpt[i]='/';
}else{
bufpt[i]=e[i];
}
|
| ︙ | ︙ | |||
667 668 669 670 671 672 673 |
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
precision = hash_digits(flag_altform2);
}
| | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
precision = hash_digits(flag_altform2);
}
length = StrNLen32(bufpt, limit);
if( precision>=0 && precision<length ) length = precision;
break;
}
case etBLOB: {
int limit = flag_alternateform ? va_arg(ap, int) : -1;
Blob *pBlob = va_arg(ap, Blob*);
bufpt = blob_buffer(pBlob);
|
| ︙ | ︙ |