[BusyBox] dietlibc patch for pre5
Erik Andersen
andersen at codepoet.org
Fri Jan 30 23:03:31 UTC 2004
On Fri Jan 30, 2004 at 03:06:19PM +0100, Hannes Reinecke wrote:
>
Some comments in addition to those from mjn3....
> diff -u -r1.54 dd.c
> --- coreutils/dd.c 20 Jun 2003 09:01:52 -0000 1.54
> +++ coreutils/dd.c 30 Jan 2004 12:53:33 -0000
> @@ -57,7 +57,7 @@
> off_t skip = 0;
> int sync_flag = FALSE;
> int noerror = FALSE;
> - int trunc = TRUE;
> + int trunc_flag = TRUE;
This is fine, and avoida a symbol naming conflict with libm.
Applied.
> --- libbb/hash_fd.c 29 Jan 2004 22:33:28 -0000 1.4
> +++ libbb/hash_fd.c 30 Jan 2004 12:53:35 -0000
> @@ -288,7 +288,7 @@
> static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
> # endif /* MD5SUM_SIZE_VS_SPEED == 0 */
>
> -typedef u_int32_t md5_uint32;
> +typedef uint32_t md5_uint32;
>
> /* Structure to save state of computation between the single steps. */
> typedef struct md5_ctx_s {
Yuck. I hate stupid typedefs like the above. Your patch is a
good start, but rather than simply fixing it to use a proper C99
types, I've gone ahead and finished the job, and removed all the
silly typedefs. Much better to use proper types throughout.
> diff -u -r1.30 nslookup.c
> --- networking/nslookup.c 19 Mar 2003 09:12:38 -0000 1.30
> +++ networking/nslookup.c 30 Jan 2004 12:53:35 -0000
> @@ -46,9 +46,9 @@
> /* only works for IPv4 */
> static int addr_fprint(char *addr)
> {
> - u_int8_t split[4];
> - u_int32_t ip;
> - u_int32_t *x = (u_int32_t *) addr;
> + uint8_t split[4];
> + uint32_t ip;
> + uint32_t *x = (uint32_t *) addr;
Good. Fixing stuff to use proper C99 types is always a good
idea. I'll go through and convert all such cases now, which will
help help the other changes you are making be more obvious.
> @@ -131,7 +131,7 @@
> /* lookup the default nameserver and display it */
> static inline void server_print(void)
> {
> - struct sockaddr_in def = _res.nsaddr_list[0];
> + struct sockaddr_in def = *(struct sockaddr_in *)_res.nsaddr_list;
Why add the unnecessary casts? Casting tends to hide bugs...
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
More information about the busybox
mailing list