Fossil SCM

s/strnlen/strnlen_/g for the local strnlen impementation because the name fataly collides with a func from standard headers in some gcc versions (e.g. GnuSolaris/Nexenta w/ gcc 4.0.x).

stephan 2008-04-25 21:45 trunk
Commit 0c78ba2eb48c14b821e5671908ec910d4b3a3dd7
1 file changed +3 -3
+3 -3
--- src/printf.c
+++ src/printf.c
@@ -153,11 +153,11 @@
153153
** Find the length of a string as long as that length does not
154154
** exceed N bytes. If no zero terminator is seen in the first
155155
** N bytes then return N. If N is negative, then this routine
156156
** is an alias for strlen().
157157
*/
158
-static int strnlen(const char *z, int N){
158
+static int strnlen_(const char *z, int N){
159159
int n = 0;
160160
while( (N-- != 0) && *(z++)!=0 ){ n++; }
161161
return n;
162162
}
163163
@@ -563,11 +563,11 @@
563563
case etPATH: {
564564
int i;
565565
int limit = flag_alternateform ? va_arg(ap,int) : -1;
566566
char *e = va_arg(ap,char*);
567567
if( e==0 ){e="";}
568
- length = strnlen(e, limit);
568
+ length = strnlen_(e, limit);
569569
zExtra = bufpt = malloc(length+1);
570570
for( i=0; i<length; i++ ){
571571
if( e[i]=='\\' ){
572572
bufpt[i]='/';
573573
}else{
@@ -584,11 +584,11 @@
584584
if( bufpt==0 ){
585585
bufpt = "";
586586
}else if( xtype==etDYNSTRING ){
587587
zExtra = bufpt;
588588
}
589
- length = strnlen(bufpt, limit);
589
+ length = strnlen_(bufpt, limit);
590590
if( precision>=0 && precision<length ) length = precision;
591591
break;
592592
}
593593
case etBLOB: {
594594
int limit = flag_alternateform ? va_arg(ap, int) : -1;
595595
--- src/printf.c
+++ src/printf.c
@@ -153,11 +153,11 @@
153 ** Find the length of a string as long as that length does not
154 ** exceed N bytes. If no zero terminator is seen in the first
155 ** N bytes then return N. If N is negative, then this routine
156 ** is an alias for strlen().
157 */
158 static int strnlen(const char *z, int N){
159 int n = 0;
160 while( (N-- != 0) && *(z++)!=0 ){ n++; }
161 return n;
162 }
163
@@ -563,11 +563,11 @@
563 case etPATH: {
564 int i;
565 int limit = flag_alternateform ? va_arg(ap,int) : -1;
566 char *e = va_arg(ap,char*);
567 if( e==0 ){e="";}
568 length = strnlen(e, limit);
569 zExtra = bufpt = malloc(length+1);
570 for( i=0; i<length; i++ ){
571 if( e[i]=='\\' ){
572 bufpt[i]='/';
573 }else{
@@ -584,11 +584,11 @@
584 if( bufpt==0 ){
585 bufpt = "";
586 }else if( xtype==etDYNSTRING ){
587 zExtra = bufpt;
588 }
589 length = strnlen(bufpt, limit);
590 if( precision>=0 && precision<length ) length = precision;
591 break;
592 }
593 case etBLOB: {
594 int limit = flag_alternateform ? va_arg(ap, int) : -1;
595
--- src/printf.c
+++ src/printf.c
@@ -153,11 +153,11 @@
153 ** Find the length of a string as long as that length does not
154 ** exceed N bytes. If no zero terminator is seen in the first
155 ** N bytes then return N. If N is negative, then this routine
156 ** is an alias for strlen().
157 */
158 static int strnlen_(const char *z, int N){
159 int n = 0;
160 while( (N-- != 0) && *(z++)!=0 ){ n++; }
161 return n;
162 }
163
@@ -563,11 +563,11 @@
563 case etPATH: {
564 int i;
565 int limit = flag_alternateform ? va_arg(ap,int) : -1;
566 char *e = va_arg(ap,char*);
567 if( e==0 ){e="";}
568 length = strnlen_(e, limit);
569 zExtra = bufpt = malloc(length+1);
570 for( i=0; i<length; i++ ){
571 if( e[i]=='\\' ){
572 bufpt[i]='/';
573 }else{
@@ -584,11 +584,11 @@
584 if( bufpt==0 ){
585 bufpt = "";
586 }else if( xtype==etDYNSTRING ){
587 zExtra = bufpt;
588 }
589 length = strnlen_(bufpt, limit);
590 if( precision>=0 && precision<length ) length = precision;
591 break;
592 }
593 case etBLOB: {
594 int limit = flag_alternateform ? va_arg(ap, int) : -1;
595

Keyboard Shortcuts

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