unsigned int -> size_t

This commit is contained in:
leitner
2007-10-17 16:23:01 +00:00
parent 67a8f54b63
commit 34c8462dea
7 changed files with 45 additions and 5 deletions

View File

@@ -4,6 +4,13 @@
int stralloc_catm_internal(stralloc* sa, ...) {
va_list a;
const char* s;
size_t n=0;
va_start(a,sa);
while ((s=va_arg(a,const char*)))
n += strlen(s);
va_end(a);
stralloc_readyplus(sa,n);
va_start(a,sa);
while ((s=va_arg(a,const char*)))
if (stralloc_cats(sa,s)==0) {

View File

@@ -1,7 +1,7 @@
#include <stralloc.h>
int stralloc_chomp(stralloc* sa) {
unsigned int max=sa->len;
size_t max=sa->len;
if (max>0) {
register char x;
--max;

View File

@@ -3,7 +3,7 @@
#include "str.h"
extern int stralloc_diff(const stralloc* a,const stralloc* b) {
register unsigned int i;
register size_t i;
register int j;
for (i=0;;++i) {
if (i==a->len) return i==b->len?0:-1; if (i==b->len) return 1;

View File

@@ -3,7 +3,7 @@
#include "str.h"
extern int stralloc_diffs(const stralloc* a,const char* b) {
register unsigned long int i;
register size_t i;
register int j;
for (i=0;;++i) {
if (i==a->len) return (!b[i])?0:-1; if (!b[i]) return 1;

View File

@@ -8,7 +8,7 @@
* bytes of space, copies the old string into the new space, frees the
* old space, and returns 1. Note that this changes sa.s. */
int stralloc_ready(stralloc *sa,size_t len) {
register int wanted=len+(len>>3)+30; /* heuristic from djb */
register size_t wanted=len+(len>>3)+30; /* heuristic from djb */
if (!sa->s || sa->a<len) {
register char* tmp;
if (!(tmp=realloc(sa->s,wanted)))

View File

@@ -3,7 +3,7 @@
#include "str.h"
extern int stralloc_starts(stralloc *sa,const char *in) {
register unsigned long int len=str_len(in);
register size_t len=str_len(in);
return (len<=sa->len && !byte_diff(sa->s,len,in));
}