use size_t for string lengths
This commit is contained in:
parent
22f4d81f3e
commit
93f96835f8
@ -39,14 +39,15 @@
|
||||
static
|
||||
char *appendstring(char *string, /* original string */
|
||||
char *buffer, /* to append */
|
||||
int *stringlen, int *stralloc)
|
||||
size_t *stringlen, /* length of string */
|
||||
size_t *stralloc) /* allocated size */
|
||||
{
|
||||
int len = strlen(buffer);
|
||||
int needed_len = len + *stringlen;
|
||||
size_t len = strlen(buffer);
|
||||
size_t needed_len = len + *stringlen;
|
||||
|
||||
if(needed_len >= *stralloc) {
|
||||
char *newptr;
|
||||
long newsize = needed_len*2; /* get twice the needed size */
|
||||
size_t newsize = needed_len*2; /* get twice the needed size */
|
||||
|
||||
newptr = realloc(string, newsize);
|
||||
if(newptr) {
|
||||
@ -74,8 +75,8 @@ const char *spitout(FILE *stream,
|
||||
char display = 0;
|
||||
|
||||
char *string;
|
||||
int stringlen=0;
|
||||
int stralloc=256;
|
||||
size_t stringlen=0;
|
||||
size_t stralloc=256;
|
||||
|
||||
enum {
|
||||
STATE_OUTSIDE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user