From: Matthew Fernandez Date: Sat, 25 Sep 2021 02:14:20 +0000 (-0700) Subject: lefty: remove unnecessary casts of char* members X-Git-Tag: 2.49.2~36^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e55ba7ab43171abdea528417c32e890a8013a157;p=graphviz lefty: remove unnecessary casts of char* members --- 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);