From 3c3f355f29b9a5706c09829f33bf937385aac3be Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Mon, 25 Jun 2007 16:42:00 +0200 Subject: [PATCH] few "byte *" -> "char *" conversions --- lib/conf-dump.c | 4 ++-- lib/conf-intr.c | 6 +++--- lib/conf-test.c | 32 ++++++++++++++++---------------- lib/conf-test.cf | 2 +- lib/fastbuf.h | 2 +- lib/kmp-test.c | 8 ++++---- lib/kmp.h | 4 ++-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/conf-dump.c b/lib/conf-dump.c index 940c7ca7..0d409240 100644 --- a/lib/conf-dump.c +++ b/lib/conf-dump.c @@ -31,8 +31,8 @@ dump_basic(struct fastbuf *fb, void *ptr, enum cf_type type, union cf_union *u) case CT_DOUBLE: bprintf(fb, "%lg ", *(double*)ptr); break; case CT_IP: bprintf(fb, "%08x ", *(uns*)ptr); break; case CT_STRING: - if (*(byte**)ptr) - bprintf(fb, "'%s' ", *(byte**)ptr); + if (*(char**)ptr) + bprintf(fb, "'%s' ", *(char**)ptr); else bprintf(fb, "NULL "); break; diff --git a/lib/conf-intr.c b/lib/conf-intr.c index 714d070e..84f555a2 100644 --- a/lib/conf-intr.c +++ b/lib/conf-intr.c @@ -322,8 +322,8 @@ interpret_set_all(struct cf_item *item, void *ptr, enum cf_operation op) static uns zero = 0; * (void**) ptr = (&zero) + 1; } else if (item->cls == CC_STATIC && item->type == CT_STRING) { - cf_journal_block(ptr, item->number * sizeof(byte*)); - bzero(ptr, item->number * sizeof(byte*)); + cf_journal_block(ptr, item->number * sizeof(char*)); + bzero(ptr, item->number * sizeof(char*)); } else return "The item is not a list, dynamic array, bitmap, or string"; return NULL; @@ -336,7 +336,7 @@ cmp_items(void *i1, void *i2, struct cf_item *item) i1 += (uintptr_t) item->ptr; i2 += (uintptr_t) item->ptr; if (item->type == CT_STRING) - return strcmp(* (byte**) i1, * (byte**) i2); + return strcmp(* (char**) i1, * (char**) i2); else // all numeric types return memcmp(i1, i2, cf_type_size(item->type, item->u.utype)); } diff --git a/lib/conf-test.c b/lib/conf-test.c index f4ca15fd..61ba4bc9 100644 --- a/lib/conf-test.c +++ b/lib/conf-test.c @@ -18,16 +18,16 @@ static int verbose; struct sub_sect_1 { cnode n; - byte *name; + char *name; time_t t; - byte *level; + char *level; int confidence[2]; double *list; }; static struct sub_sect_1 sec1 = { {}, "Charlie", 0, "WBAFC", { 0, -1}, DARY_ALLOC(double, 3, 1e4, -1e-4, 8) }; -static byte * +static char * init_sec_1(struct sub_sect_1 *s) { if (s == &sec1) // this is a static variable; skip clearing @@ -40,7 +40,7 @@ init_sec_1(struct sub_sect_1 *s) return NULL; } -static byte * +static char * commit_sec_1(struct sub_sect_1 *s) { if (s->confidence[0] < 0 || s->confidence[0] > 10) @@ -48,8 +48,8 @@ commit_sec_1(struct sub_sect_1 *s) return NULL; } -static byte * -time_parser(uns number, byte **pars, time_t *ptr) +static char * +time_parser(uns number, char **pars, time_t *ptr) { *ptr = number ? atoi(pars[0]) : time(NULL); return NULL; @@ -74,8 +74,8 @@ static struct cf_section cf_sec_1 = { static uns nr1 = 15; static int *nrs1 = DARY_ALLOC(int, 5, 5, 4, 3, 2, 1); static int nrs2[5]; -static byte *str1 = "no worries"; -static byte **str2 = DARY_ALLOC(byte *, 2, "Alice", "Bob"); +static char *str1 = "no worries"; +static char **str2 = DARY_ALLOC(char *, 2, "Alice", "Bob"); static u64 u1 = 0xCafeBeefDeadC00ll; static double d1 = -1.1; static clist secs; @@ -86,11 +86,11 @@ static u16 numbers[10] = { 2, 100, 1, 5 }; static u32 bitmap1 = 0xff; static u32 bitmap2 = 3; -static byte * -parse_u16(byte *string, u16 *ptr) +static char * +parse_u16(char *string, u16 *ptr) { uns a; - byte *msg = cf_parse_int(string, &a); + char *msg = cf_parse_int(string, &a); if (msg) return msg; if (a >= (1<<16)) @@ -112,7 +112,7 @@ static struct cf_user_type u16_type = { .dumper = (cf_dumper1*) dump_u16 }; -static byte * +static char * init_top(void *ptr UNUSED) { for (uns i=0; i<5; i++) @@ -125,7 +125,7 @@ init_top(void *ptr UNUSED) return NULL; } -static byte * +static char * commit_top(void *ptr UNUSED) { if (nr1 != 15) @@ -133,7 +133,7 @@ commit_top(void *ptr UNUSED) return NULL; } -static byte *alphabet[] = { "alpha", "beta", "gamma", "delta", NULL }; +static char *alphabet[] = { "alpha", "beta", "gamma", "delta", NULL }; static struct cf_section cf_top = { CF_INIT(init_top), CF_COMMIT(commit_top), @@ -153,7 +153,7 @@ static struct cf_section cf_top = { CF_LOOKUP_DYN("look", &look, alphabet, 1000), CF_USER_ARY("numbers", numbers, &u16_type, 10), CF_BITMAP_INT("bitmap1", &bitmap1), - CF_BITMAP_LOOKUP("bitmap2", &bitmap2, ((byte*[]) { + CF_BITMAP_LOOKUP("bitmap2", &bitmap2, ((char*[]) { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "seventeen", "eighteen", "nineteen", "twenty", NULL // hidden joke here @@ -178,7 +178,7 @@ CF_USAGE "; static void NONRET -usage(byte *msg, ...) +usage(char *msg, ...) { va_list va; va_start(va, msg); diff --git a/lib/conf-test.cf b/lib/conf-test.cf index 91e6cc3b..72138ea4 100644 --- a/lib/conf-test.cf +++ b/lib/conf-test.cf @@ -1,7 +1,7 @@ # test config file #include lib/conf-test.t ; top.xa=1 #include 'non-existent file'; #top.xa=1 -Top { \ +Top { nr1=16 #!!! nrs1 2 3 5 \ diff --git a/lib/fastbuf.h b/lib/fastbuf.h index 55f3d72b..1589843d 100644 --- a/lib/fastbuf.h +++ b/lib/fastbuf.h @@ -63,7 +63,7 @@ struct fastbuf { byte is_fastbuf[0]; /* Dummy field for checking of type casts */ byte *bptr, *bstop; /* Access pointers */ byte *buffer, *bufend; /* Start and end of the buffer */ - byte *name; /* File name for error messages */ + char *name; /* File name for error messages */ sh_off_t pos; /* Position of bstop in the file */ int (*refill)(struct fastbuf *); /* Get a buffer with new data */ void (*spout)(struct fastbuf *); /* Write buffer data to the file */ diff --git a/lib/kmp-test.c b/lib/kmp-test.c index fcbc96ef..c066e6ea 100644 --- a/lib/kmp-test.c +++ b/lib/kmp-test.c @@ -56,9 +56,9 @@ test1(void) #define KMP_USE_UTF8 #define KMP_TOLOWER #define KMP_ONLYALPHA -#define KMP_STATE_VARS byte *str; uns id; +#define KMP_STATE_VARS char *str; uns id; #define KMP_ADD_EXTRA_ARGS uns id -#define KMP_VARS byte *start; +#define KMP_VARS char *start; #define KMP_ADD_INIT(kmp,src) kmp->u.start = src #define KMP_ADD_NEW(kmp,src,s) do{ TRACE("Inserting string %s with id %d", kmp->u.start, id); \ s->u.str = kmp->u.start; s->u.id = id; }while(0) @@ -94,7 +94,7 @@ test2(void) #define KMP_PREFIX(x) kmp3_##x #define KMP_STATE_VARS uns index; #define KMP_ADD_EXTRA_ARGS uns index -#define KMP_VARS byte *start; +#define KMP_VARS char *start; #define KMP_ADD_INIT(kmp,src) kmp->u.start = src #define KMP_ADD_NEW(kmp,src,s) s->u.index = index #define KMP_ADD_DUP(kmp,src,s) *(kmp->u.start) = 0 @@ -113,7 +113,7 @@ test3(void) { mp_flush(pool); uns n = random_max(100); - byte *s[n]; + char *s[n]; struct kmp3_struct kmp; kmp3_init(&kmp); for (uns i = 0; i < n; i++) diff --git a/lib/kmp.h b/lib/kmp.h index aa889f69..8c8c5254 100644 --- a/lib/kmp.h +++ b/lib/kmp.h @@ -256,7 +256,7 @@ struct P(struct) { #ifdef KMP_SOURCE typedef KMP_SOURCE P(source_t); #else -typedef byte *P(source_t); +typedef char *P(source_t); #endif #ifdef KMP_GET_CHAR @@ -281,7 +281,7 @@ P(get_char) (struct P(struct) *kmp UNUSED, P(source_t) *src, P(char_t) *c) { # ifdef KMP_USE_UTF8 uns cc; - *src = (byte *)utf8_get(*src, &cc); + *src = utf8_get(*src, &cc); # ifdef KMP_ONLYALPHA if (!cc) {} else if (!Ualpha(cc)) -- 2.39.2