tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

why cast to char* through void*



Either I have a brain-block, or I'm missing something, or...

A long time ago I suggested to myself in a comment in login_cap.c that
the pointer arithmetic in setuserenv() should be replaced with an array
reference and thus avoid a lot of ugliness.

I see that's been done now, but the cast to char* through void* remains.

It doesn't make any sense to me -- there shouldn't be any alignment
work-arounds necessary here (should there?), and I see no other possible
reason for it.


--- login_cap.c 10 Feb 2007 12:57:39 -0500      1.25
+++ login_cap.c 01 Jul 2009 15:14:06 -0400      
@@ -517,8 +517,8 @@
        if (!res)
                return -1;
        
-       ptr = (char *)(void *)&res[count];
-       (void)strcpy(ptr, str);
+       ptr = (char *) &res[count];
+       (void) strcpy(ptr, str);
 
        /* split string */
        for (i = 0; (res[i] = stresep(&ptr, stop, '\\')) != NULL; )

-- 
                                                Greg A. Woods

+1 416 218-0098                VE3TCP          RoboHack 
<woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>      Secrets of the Weird 
<woods%weird.com@localhost>

Attachment: pgptStrJFWxxe.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index