]> mj.ucw.cz Git - libucw.git/commitdiff
few "byte *" -> "char *" conversions
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 25 Jun 2007 14:42:00 +0000 (16:42 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 25 Jun 2007 14:42:00 +0000 (16:42 +0200)
lib/conf-dump.c
lib/conf-intr.c
lib/conf-test.c
lib/conf-test.cf
lib/fastbuf.h
lib/kmp-test.c
lib/kmp.h

index 940c7ca7242c0e94a86515297f400c31a7eb1eed..0d4092400f52b0da6632885594de3a38b47afcd3 100644 (file)
@@ -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;
index 714d070e272f18d4baec5ce1a4808ecce897d106..84f555a29962cc5d3a809c9b863f6357ab8cdbdc 100644 (file)
@@ -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));
 }
index f4ca15fdb7fba7022eb8da4ad34c876df3e853e9..61ba4bc9edfe3f5381080f71c9066bdb7031aa86 100644 (file)
@@ -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);
index 91e6cc3b08b3eefb5bc32000b4f9cf451d646351..72138ea4083a6fd37527856fb1764648e2307b3a 100644 (file)
@@ -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 \
index 55f3d72b3dd884c8f31b2e4cc3cab1ff74c30862..1589843d5e3ccde0a701004ee893812b9a37c1af 100644 (file)
@@ -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 */
index fcbc96efcff40a7e3997205c76f7207c89611beb..c066e6ea916246c20a08d759fc781bb4cec87eb6 100644 (file)
@@ -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++)
index aa889f694d08b25209b71cc17970af7ad8144806..8c8c525448f148f5b7ab9495415752e6736e8d86 100644 (file)
--- 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))