From e55ba7ab43171abdea528417c32e890a8013a157 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 24 Sep 2021 19:14:20 -0700 Subject: [PATCH] lefty: remove unnecessary casts of char* members --- cmd/lefty/aix_mods/tbl.c | 2 +- cmd/lefty/code.c | 4 ++-- cmd/lefty/code.h | 2 +- cmd/lefty/tbl.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/lefty/aix_mods/tbl.c b/cmd/lefty/aix_mods/tbl.c index 5b99e0a82..7713088b9 100644 --- a/cmd/lefty/aix_mods/tbl.c +++ b/cmd/lefty/aix_mods/tbl.c @@ -175,7 +175,7 @@ Tobj Tcode(Code_t * cp, int ci, int cl) cp2[i] = cp[i]; if (cp2[i].next != C_NULL) cp2[i].next -= ci; - s = (char *) &cp[i].u.s; + s = &cp[i].u.s; while (*s) s++; cn = (long) (s - (char *) &cp[i]) / sizeof(Code_t); diff --git a/cmd/lefty/code.c b/cmd/lefty/code.c index d8d576b3d..234b2f16a 100644 --- a/cmd/lefty/code.c +++ b/cmd/lefty/code.c @@ -27,7 +27,7 @@ void Cinit (void) { cbufp = Marrayalloc(CBUFINCR * CBUFSIZE); cbufn = CBUFINCR; cbufi = 0; - Cstringoffset = (char *) &c.u.s[0] - (char *) &c + 1; + Cstringoffset = &c.u.s[0] - (char *)&c + 1; /* the + 1 above accounts for the null character */ } @@ -93,7 +93,7 @@ int Cstring (char *s) { } i = cbufi, cbufi += size; cbufp[i].ctype = C_STRING; - strcpy ((char *) &cbufp[i].u.s[0], s); + strcpy(&cbufp[i].u.s[0], s); cbufp[i].next = C_NULL; return i; } diff --git a/cmd/lefty/code.h b/cmd/lefty/code.h index f09861edb..0ea6fe658 100644 --- a/cmd/lefty/code.h +++ b/cmd/lefty/code.h @@ -70,7 +70,7 @@ typedef struct Code_t { } Code_t; #define C_CODESIZE sizeof (Code_t) -#define Cgetstring(i) (char *) &cbufp[i].u.s[0] +#define Cgetstring(i) &cbufp[i].u.s[0] #define Cgetindex() cbufi #define Csettype(a, b) cbufp[a].ctype = b diff --git a/cmd/lefty/tbl.c b/cmd/lefty/tbl.c index 87def1172..54ac4ed08 100644 --- a/cmd/lefty/tbl.c +++ b/cmd/lefty/tbl.c @@ -170,7 +170,7 @@ Tobj Tcode (Code_t *cp, int ci, int cl) { cp2[i] = cp[i]; if (cp2[i].next != C_NULL) cp2[i].next -= ci; - s = (char *) &cp[i].u.s; + s = &cp[i].u.s; while (*s) s++; cn = (long) (s - (char *) &cp[i]) / sizeof (Code_t); -- 2.40.0