gcc 4 cleanups (mostly unsigned char* vs char*)
This commit is contained in:
@@ -4,7 +4,7 @@ stralloc_append \- append a character to a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_append\fP(stralloc* \fIsa\fR,const unsigned char* \fIin\fR);
|
||||
int \fBstralloc_append\fP(stralloc* \fIsa\fR,const char* \fIin\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_append appends the byte from *\fIbuf\fR to the
|
||||
string stored in \fIsa\fR, allocating space if necessary, and
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* stralloc_append adds one byte in[0] to the end of the string stored
|
||||
* in sa. It is the same as stralloc_catb(&sa,in,1). */
|
||||
int stralloc_append(stralloc *sa,const unsigned char *in) {
|
||||
int stralloc_append(stralloc *sa,const char *in) {
|
||||
if (stralloc_readyplus(sa,1)) {
|
||||
sa->s[sa->len]=*in;
|
||||
++sa->len;
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_catb \- append data to a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_catb\fP(stralloc* \fIsa\fR,const unsigned char* \fIbuf\fR,unsigned long int \fIlen\fR);
|
||||
int \fBstralloc_catb\fP(stralloc* \fIsa\fR,const char* \fIbuf\fR,unsigned long int \fIlen\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_catb adds the string \fIbuf\fR[0], \fIbuf\fR[1], ... \fIbuf\fR[\fIlen\fR-1] to the
|
||||
end of the string stored in \fIsa\fR, allocating space if necessary, and
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* returns 1. If sa is unallocated, stralloc_catb is the same as
|
||||
* stralloc_copyb. If it runs out of memory, stralloc_catb leaves sa
|
||||
* alone and returns 0. */
|
||||
int stralloc_catb(stralloc *sa,const unsigned char *buf,unsigned long int len) {
|
||||
int stralloc_catb(stralloc *sa,const char *buf,unsigned long int len) {
|
||||
if (stralloc_readyplus(sa,len)) {
|
||||
byte_copy(sa->s+sa->len,len,buf);
|
||||
sa->len+=len;
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_catm \- append string(s) to a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_catm\fP(stralloc* \fIsa\fR,const unsigned char* \fIs\fR, ...);
|
||||
int \fBstralloc_catm\fP(stralloc* \fIsa\fR,const char* \fIs\fR, ...);
|
||||
.SH DESCRIPTION
|
||||
stralloc_catm appends \\0-terminated strings from \fIs\fR... to the
|
||||
end of the string stored in \fIsa\fR, allocating space if necessary, and
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_cats \- append data to a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_cats\fP(stralloc* \fIsa\fR,const unsigned char* \fIbuf\fR);
|
||||
int \fBstralloc_cats\fP(stralloc* \fIsa\fR,const char* \fIbuf\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_cats appends a \\0-terminated string from \fIbuf\fR to the
|
||||
end of the string stored in \fIsa\fR, allocating space if necessary, and
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "stralloc.h"
|
||||
#include "str.h"
|
||||
|
||||
extern int stralloc_cats(stralloc *sa,const unsigned char *buf) {
|
||||
extern int stralloc_cats(stralloc *sa,const char *buf) {
|
||||
return stralloc_catb(sa,buf,str_len(buf));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_copyb \- copy data into a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_copyb\fP(stralloc* \fIsa\fR,const unsigned char* \fIbuf\fR,unsigned long int \fIlen\fR);
|
||||
int \fBstralloc_copyb\fP(stralloc* \fIsa\fR,const char* \fIbuf\fR,unsigned long int \fIlen\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_copyb makes sure that \fIsa\fR has enough space allocated to hold
|
||||
\fIlen\fR bytes. Then it copies the first \fIlen\fR bytes from
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* stralloc_copyb copies the string buf[0], buf[1], ..., buf[len-1] into
|
||||
* sa, allocating space if necessary, and returns 1. If it runs out of
|
||||
* memory, stralloc_copyb leaves sa alone and returns 0. */
|
||||
int stralloc_copyb(stralloc *sa,const unsigned char *buf,unsigned long int len) {
|
||||
int stralloc_copyb(stralloc *sa,const char *buf,unsigned long int len) {
|
||||
if (stralloc_ready(sa,len)) {
|
||||
sa->len=len;
|
||||
byte_copy(sa->s,len,buf);
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_copys \- copy data into a stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_copys\fP(stralloc* \fIsa\fR,const unsigned char* \fIbuf\fR);
|
||||
int \fBstralloc_copys\fP(stralloc* \fIsa\fR,const char* \fIbuf\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_copys copies a \\0-terminated string from \fIbuf\fR into
|
||||
\fIsa\fR, without the \\0. It is the same as
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "stralloc.h"
|
||||
#include "str.h"
|
||||
|
||||
extern int stralloc_copys(stralloc *sa,const unsigned char *buf) {
|
||||
extern int stralloc_copys(stralloc *sa,const char *buf) {
|
||||
return stralloc_copyb(sa,buf,str_len(buf));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern int stralloc_diff(const stralloc* a,const stralloc* b) {
|
||||
register int j;
|
||||
for (i=0;;++i) {
|
||||
if (i==a->len) return i==b->len?0:-1; if (i==b->len) return 1;
|
||||
if ((j=(a->s[i]-b->s[i]))) return j;
|
||||
if ((j=((unsigned char)(a->s[i])-(unsigned char)(b->s[i])))) return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_diffs \- check if string is prefix of stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_diffs\fP(stralloc* \fIa\fR,const unsigned char* \fIb\fR);
|
||||
int \fBstralloc_diffs\fP(stralloc* \fIa\fR,const char* \fIb\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_diffs returns negative, 0, or positive, depending on whether
|
||||
the \\0-terminated string in \fIa\fR, without
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#include "byte.h"
|
||||
#include "str.h"
|
||||
|
||||
extern int stralloc_diffs(const stralloc* a,const unsigned char* b) {
|
||||
extern int stralloc_diffs(const stralloc* a,const char* b) {
|
||||
register unsigned long int i;
|
||||
register int j;
|
||||
for (i=0;;++i) {
|
||||
if (i==a->len) return (!b[i])?0:-1; if (!b[i]) return 1;
|
||||
if ((j=(a->s[i]-b[i]))) return j;
|
||||
if ((j=((unsigned char)(a->s[i])-(unsigned char)(b[i])))) return j;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ stralloc_starts \- check if string is prefix of stralloc
|
||||
.SH SYNTAX
|
||||
.B #include <stralloc.h>
|
||||
|
||||
int \fBstralloc_starts\fP(stralloc* \fIsa\fR,const unsigned char* \fIin\fR);
|
||||
int \fBstralloc_starts\fP(stralloc* \fIsa\fR,const char* \fIin\fR);
|
||||
.SH DESCRIPTION
|
||||
stralloc_starts returns 1 if the \\0-terminated string in \fIin\fR, without
|
||||
the terminating \\0, is a prefix of the string stored in \fIsa\fR. Otherwise
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "byte.h"
|
||||
#include "str.h"
|
||||
|
||||
extern int stralloc_starts(stralloc *sa,const unsigned char *in) {
|
||||
extern int stralloc_starts(stralloc *sa,const char *in) {
|
||||
register unsigned long int len=str_len(in);
|
||||
return (len<=sa->len && !byte_diff(sa->s,len,in));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user