This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RedBoot: Cleanup excessive indirection in option argument handling.


Hi,

RedBoot's init_opts()/scan_opts() use an excessive level of indirection for the handling of option arguments. GCC 3.3 chokes on it with warnings about "dereferencing type-punned pointer will break strict-aliasing rules".

Expect a patch later cleaning up all the typecasts in the init_opts()/scan_opts() calls.

Here are some of them (redboot and generic i386 and arm). Other architectures and boards are left as a exercise for the reader...


2003-10-01 David Vrabel <dvrabel@arcom.com>

	* Various: Remove unnecessary typecasts in calls to init_opts()
	and scan_opts().

David Vrabel
--
David Vrabel, Design Engineer

Arcom                         Tel: +44 (0)1223 411200 ext. 3233
Clifton Road                  Fax: +44 (0)1223 403400
Cambridge CB1 7EA             E-mail: dvrabel@arcom.com
UK                            Web: http://www.arcom.com/


________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________
Index: packages/redboot/current/src/cksum.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/cksum.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 cksum.c
--- packages/redboot/current/src/cksum.c	29 May 2003 10:55:49 -0000	1.1.1.1
+++ packages/redboot/current/src/cksum.c	1 Oct 2003 08:28:15 -0000
@@ -71,9 +71,9 @@ do_cksum(int argc, char *argv[])
     bool base_set, len_set;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
+              &base, &base_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
+              &len, &len_set, "length");
     if (!scan_opts(argc, argv, 1, opts, 2, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/date.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/date.c,v
retrieving revision 1.1
diff -u -B -p -r1.1 date.c
--- packages/redboot/current/src/date.c	18 Jul 2003 13:38:52 -0000	1.1
+++ packages/redboot/current/src/date.c	1 Oct 2003 08:28:15 -0000
@@ -76,17 +76,17 @@ do_date(int argc, char *argv[])
     cyg_uint32 t;
 
     init_opts(&opts[0], 'Y', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&year, 0, "year");
+              &year, 0, "year");
     init_opts(&opts[1], 'M', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&month, 0, "month");
+              &month, 0, "month");
     init_opts(&opts[2], 'D', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&day, 0, "day");
+              &day, 0, "day");
     init_opts(&opts[3], 'h', true, OPTION_ARG_TYPE_NUM,
-              (void **)&hour, 0, "hours");
+              &hour, 0, "hours");
     init_opts(&opts[4], 'm', true, OPTION_ARG_TYPE_NUM,
-              (void **)&min, 0, "minutes");
+              &min, 0, "minutes");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM,
-              (void **)&sec, 0, "seconds");
+              &sec, 0, "seconds");
 
     /* Set date if there are any options. */
     if (argc > 1) {
Index: packages/redboot/current/src/dump.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/dump.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 dump.c
--- packages/redboot/current/src/dump.c	29 May 2003 10:55:49 -0000	1.1.1.1
+++ packages/redboot/current/src/dump.c	1 Oct 2003 08:28:15 -0000
@@ -79,17 +79,17 @@ do_dump(int argc, char *argv[])
     cyg_uint8 ch;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
+              &base, &base_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
+              &len, &len_set, "length");
     init_opts(&opts[2], 's', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&srec_dump, 0, "dump data using Morotola S-records");
+              &srec_dump, 0, "dump data using Morotola S-records");
     init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "dump 32 bit units");
+              &set_32bit, 0, "dump 32 bit units");
     init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "dump 16 bit units");
+              &set_16bit, 0, "dump 16 bit units");
     init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "dump 8 bit units");
+              &set_8bit, 0, "dump 8 bit units");
     if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/flash.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.12
diff -u -B -p -r1.12 flash.c
--- packages/redboot/current/src/flash.c	30 Sep 2003 12:35:56 -0000	1.12
+++ packages/redboot/current/src/flash.c	1 Oct 2003 08:28:15 -0000
@@ -273,7 +273,7 @@ fis_init(int argc, char *argv[])
     unsigned long redboot_image_size;
 
     init_opts(&opts[0], 'f', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&full_init, (bool *)0, "full initialization, erases all of flash");
+              &full_init, 0, "full initialization, erases all of flash");
     if (!scan_opts(argc, argv, 2, opts, 1, 0, 0, ""))
     {
         return;
@@ -440,10 +440,10 @@ fis_list(int argc, char *argv[])
     struct option_info opts[2];
 
     init_opts(&opts[0], 'd', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&show_datalen, (bool *)0, "display data length");
+              &show_datalen, 0, "display data length");
 #ifdef CYGSEM_REDBOOT_FIS_CRC_CHECK
     init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&show_cksums, (bool *)0, "display checksums");
+              &show_cksums, 0, "display checksums");
     i = 2;
 #else
     i = 1;
@@ -582,20 +582,20 @@ fis_create(int argc, char *argv[])
     bool prog_ok = true;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&mem_addr, (bool *)&mem_addr_set, "memory base address");
+              &mem_addr, &mem_addr_set, "memory base address");
     init_opts(&opts[1], 'r', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&exec_addr, (bool *)&exec_addr_set, "ram base address");
+              &exec_addr, &exec_addr_set, "ram base address");
     init_opts(&opts[2], 'e', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&entry_addr, (bool *)&entry_addr_set, "entry point address");
+              &entry_addr, &entry_addr_set, "entry point address");
     init_opts(&opts[3], 'f', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address");
+              &flash_addr, &flash_addr_set, "FLASH memory base address");
     init_opts(&opts[4], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "image length [in FLASH]");
+              &length, &length_set, "image length [in FLASH]");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&img_size, (bool *)&img_size_set, "image size [actual data]");
+              &img_size, &img_size_set, "image size [actual data]");
     init_opts(&opts[6], 'n', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&no_copy, (bool *)0, "don't copy from RAM to FLASH, just update directory");
-    if (!scan_opts(argc, argv, 2, opts, 7, (void *)&name, OPTION_ARG_TYPE_STR, "file name"))
+              &no_copy, 0, "don't copy from RAM to FLASH, just update directory");
+    if (!scan_opts(argc, argv, 2, opts, 7, &name, OPTION_ARG_TYPE_STR, "file name"))
     {
         fis_usage("invalid arguments");
         return;
@@ -772,7 +772,7 @@ fis_delete(int argc, char *argv[])
     cyg_flash_offset_t err_addr;
     struct fis_image_desc *img;
 
-    if (!scan_opts(argc, argv, 2, 0, 0, (void **)&name, OPTION_ARG_TYPE_STR, "image name"))
+    if (!scan_opts(argc, argv, 2, 0, 0, &name, OPTION_ARG_TYPE_STR, "image name"))
     {
         fis_usage("invalid arguments");
         return;
@@ -841,17 +841,17 @@ fis_load(int argc, char *argv[])
 #endif
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&mem_addr, (bool *)&mem_addr_set, "memory [load] base address");
+              &mem_addr, &mem_addr_set, "memory [load] base address");
     init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&show_cksum, (bool *)0, "display checksum");
+              &show_cksum, 0, "display checksum");
     num_options = 2;
 #ifdef CYGPKG_COMPRESS_ZLIB
     init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&decompress, 0, "decompress");
+              &decompress, 0, "decompress");
     num_options++;
 #endif
 
-    if (!scan_opts(argc, argv, 2, opts, num_options, (void **)&name, OPTION_ARG_TYPE_STR, "image name"))
+    if (!scan_opts(argc, argv, 2, opts, num_options, &name, OPTION_ARG_TYPE_STR, "image name"))
     {
         fis_usage("invalid arguments");
         return;
@@ -945,11 +945,11 @@ fis_write(int argc, char *argv[])
     bool prog_ok;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&mem_addr, (bool *)&mem_addr_set, "memory base address");
+              &mem_addr, &mem_addr_set, "memory base address");
     init_opts(&opts[1], 'f', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address");
+              &flash_addr, &flash_addr_set, "FLASH memory base address");
     init_opts(&opts[2], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "image length [in FLASH]");
+              &length, &length_set, "image length [in FLASH]");
     if (!scan_opts(argc, argv, 2, opts, 3, 0, 0, 0))
     {
         fis_usage("invalid arguments");
@@ -1020,10 +1020,10 @@ fis_erase(int argc, char *argv[])
     struct option_info opts[2];
 
     init_opts(&opts[0], 'f', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address");
+              &flash_addr, &flash_addr_set, "FLASH memory base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "length");
-    if (!scan_opts(argc, argv, 2, opts, 2, (void **)0, 0, ""))
+              &length, &length_set, "length");
+    if (!scan_opts(argc, argv, 2, opts, 2, 0, 0, ""))
     {
         fis_usage("invalid arguments");
         return;
@@ -1069,10 +1069,10 @@ fis_lock(int argc, char *argv[])
     struct option_info opts[2];
 
     init_opts(&opts[0], 'f', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address");
+              &flash_addr, &flash_addr_set, "FLASH memory base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "length");
-    if (!scan_opts(argc, argv, 2, opts, 2, (void **)&name, OPTION_ARG_TYPE_STR, "image name"))
+              &length, &length_set, "length");
+    if (!scan_opts(argc, argv, 2, opts, 2, &name, OPTION_ARG_TYPE_STR, "image name"))
     {
         fis_usage("invalid arguments");
         return;
@@ -1120,10 +1120,10 @@ fis_unlock(int argc, char *argv[])
     struct option_info opts[2];
 
     init_opts(&opts[0], 'f', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address");
+              &flash_addr, &flash_addr_set, "FLASH memory base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "length");
-    if (!scan_opts(argc, argv, 2, opts, 2, (void **)&name, OPTION_ARG_TYPE_STR, "image name"))
+              &length, &length_set, "length");
+    if (!scan_opts(argc, argv, 2, opts, 2, &name, OPTION_ARG_TYPE_STR, "image name"))
     {
         fis_usage("invalid arguments");
         return;
@@ -1626,15 +1626,15 @@ do_flash_config(int argc, char *argv[])
     script = (unsigned char *)0;
 
     init_opts(&opts[0], 'l', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&list_only, (bool *)0, "list configuration only");
+              &list_only, 0, "list configuration only");
     init_opts(&opts[1], 'n', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&nicknames, (bool *)0, "show nicknames");
+              &nicknames, 0, "show nicknames");
     init_opts(&opts[2], 'f', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&fullnames, (bool *)0, "show full names");
+              &fullnames, 0, "show full names");
     init_opts(&opts[3], 'i', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&init, (bool *)0, "initialize configuration database");
+              &init, 0, "initialize configuration database");
     init_opts(&opts[4], 'd', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&dumbterminal, (bool *)0, "dumb terminal: no clever edits");
+              &dumbterminal, 0, "dumb terminal: no clever edits");
 
     // First look to see if we are setting or getting a single option
     // by just quoting its nickname
Index: packages/redboot/current/src/iomem.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/iomem.c,v
retrieving revision 1.1
diff -u -B -p -r1.1 iomem.c
--- packages/redboot/current/src/iomem.c	29 May 2003 13:26:32 -0000	1.1
+++ packages/redboot/current/src/iomem.c	1 Oct 2003 08:28:15 -0000
@@ -81,15 +81,15 @@ do_poke(int argc, char *argv[])
     int size = 1;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
+              &base, &base_set, "base address");
     init_opts(&opts[1], 'v', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&value, (bool *)&value_set, "valuex");
+              &value, &value_set, "valuex");
     init_opts(&opts[2], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "output 32 bit units");
+              &set_32bit, 0, "output 32 bit units");
     init_opts(&opts[3], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "output 16 bit units");
+              &set_16bit, 0, "output 16 bit units");
     init_opts(&opts[4], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "output 8 bit units");
+              &set_8bit, 0, "output 8 bit units");
     if (!scan_opts(argc, argv, 1, opts, 5, 0, 0, "")) {
         return;
     }
@@ -134,13 +134,13 @@ do_peek(int argc, char *argv[])
     int size = 1, value;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
+              &base, &base_set, "base address");
     init_opts(&opts[1], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "output 32 bit units");
+              &set_32bit, 0, "output 32 bit units");
     init_opts(&opts[2], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "output 16 bit units");
+              &set_16bit, 0, "output 16 bit units");
     init_opts(&opts[3], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "output 8 bit units");
+              &set_8bit, 0, "output 8 bit units");
     if (!scan_opts(argc, argv, 1, opts, 5, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/load.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/load.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 load.c
--- packages/redboot/current/src/load.c	29 May 2003 10:55:49 -0000	1.1.1.1
+++ packages/redboot/current/src/load.c	1 Oct 2003 08:28:15 -0000
@@ -610,32 +610,32 @@ do_load(int argc, char *argv[])
 #endif
 
     init_opts(&opts[0], 'v', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&verbose, 0, "verbose");
+              &verbose, 0, "verbose");
     init_opts(&opts[1], 'r', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&raw, 0, "load raw data");
+              &raw, 0, "load raw data");
     init_opts(&opts[2], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_addr_set, "load address");
+              &base, &base_addr_set, "load address");
     init_opts(&opts[3], 'm', true, OPTION_ARG_TYPE_STR, 
-              (void **)&mode_str, (bool *)&mode_str_set, "download mode (TFTP, xyzMODEM, or disk)");
+              &mode_str, &mode_str_set, "download mode (TFTP, xyzMODEM, or disk)");
     num_options = 4;
 #if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
     init_opts(&opts[num_options], 'c', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&chan, (bool *)&chan_set, "I/O channel");
+              &chan, &chan_set, "I/O channel");
     num_options++;
 #endif
 #ifdef CYGPKG_REDBOOT_NETWORKING
     init_opts(&opts[num_options], 'h', true, OPTION_ARG_TYPE_STR, 
-              (void **)&hostname, (bool *)&hostname_set, "host name or IP address");
+              &hostname, &hostname_set, "host name or IP address");
     num_options++;
 #endif
 #ifdef CYGPKG_COMPRESS_ZLIB
     init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&decompress, 0, "decompress");
+              &decompress, 0, "decompress");
     num_options++;
 #endif
 
     if (!scan_opts(argc, argv, 1, opts, num_options, 
-                   (void *)&filename, OPTION_ARG_TYPE_STR, "file name")) {
+                   &filename, OPTION_ARG_TYPE_STR, "file name")) {
         return;
     }
 #ifdef CYGPKG_REDBOOT_NETWORKING
Index: packages/redboot/current/src/main.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/main.c,v
retrieving revision 1.3
diff -u -B -p -r1.3 main.c
--- packages/redboot/current/src/main.c	25 Sep 2003 13:33:12 -0000	1.3
+++ packages/redboot/current/src/main.c	1 Oct 2003 08:28:15 -0000
@@ -414,7 +414,7 @@ do_help(int argc, char *argv[])
     struct cmd *cmd;
     char *which = (char *)0;
 
-    if (!scan_opts(argc, argv, 1, 0, 0, (void **)&which, OPTION_ARG_TYPE_STR, "<topic>")) {
+    if (!scan_opts(argc, argv, 1, 0, 0, &which, OPTION_ARG_TYPE_STR, "<topic>")) {
         diag_printf("Invalid argument\n");
         return;
     }
@@ -473,16 +473,16 @@ do_go(int argc, char *argv[])
 
     entry = entry_address;  // Default from last 'load' operation
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
+              &wait_time, &wait_time_set, "wait timeout");
     init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&cache_enabled, (bool *)0, "go with caches enabled");
+              &cache_enabled, 0, "go with caches enabled");
     num_options = 2;
 #ifdef CYGPKG_IO_ETH_DRIVERS
     init_opts(&opts[2], 'n', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&stop_net, (bool *)0, "go with network driver stopped");
+              &stop_net, 0, "go with network driver stopped");
     num_options++;
 #endif
-    if (!scan_opts(argc, argv, 1, opts, num_options, (void *)&entry, OPTION_ARG_TYPE_NUM, "starting address"))
+    if (!scan_opts(argc, argv, 1, opts, num_options, &entry, OPTION_ARG_TYPE_NUM, "starting address"))
     {
         return;
     }
@@ -630,7 +630,7 @@ do_baud_rate(int argc, char *argv[])
 #endif
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&new_rate, (bool *)&new_rate_set, "new baud rate");
+              &new_rate, &new_rate_set, "new baud rate");
     if (!scan_opts(argc, argv, 1, opts, 1, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/mcmp.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/mcmp.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 mcmp.c
--- packages/redboot/current/src/mcmp.c	29 May 2003 10:55:49 -0000	1.1.1.1
+++ packages/redboot/current/src/mcmp.c	1 Oct 2003 08:28:15 -0000
@@ -72,17 +72,17 @@ do_mcmp(int argc, char *argv[])
     bool set_32bit, set_16bit, set_8bit;
 
     init_opts(&opts[0], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&src_base, (bool *)&src_base_set, "base address");
+              &src_base, &src_base_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
+              &len, &len_set, "length");
     init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&dst_base, (bool *)&dst_base_set, "base address");
+              &dst_base, &dst_base_set, "base address");
     init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
+              &set_32bit, 0, "fill 32 bit units");
     init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
+              &set_16bit, 0, "fill 16 bit units");
     init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
+              &set_8bit, 0, "fill 8 bit units");
     if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/mcopy.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/mcopy.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 mcopy.c
--- packages/redboot/current/src/mcopy.c	29 Aug 2003 10:11:35 -0000	1.1.1.1
+++ packages/redboot/current/src/mcopy.c	1 Oct 2003 08:28:15 -0000
@@ -64,17 +64,17 @@ do_mcopy(int argc, char *argv[])
     int incr = 1;
 
     init_opts(&opts[0], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&src, (bool *)&src_set, "base address");
+              &src, &src_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
+              &len, &len_set, "length");
     init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&dst, (bool *)&dst_set, "base address");
+              &dst, &dst_set, "base address");
     init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&sz32, (bool *)0, "copy 32 bit data");
+              &sz32, 0, "copy 32 bit data");
     init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&sz16, (bool *)0, "copy 16 bit data");
+              &sz16, 0, "copy 16 bit data");
     init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&sz8, (bool *)0, "copy 8 bit data");
+              &sz8, 0, "copy 8 bit data");
     if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/mfill.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/mfill.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 mfill.c
--- packages/redboot/current/src/mfill.c	29 May 2003 10:55:49 -0000	1.1.1.1
+++ packages/redboot/current/src/mfill.c	1 Oct 2003 08:28:15 -0000
@@ -72,17 +72,17 @@ do_mfill(int argc, char *argv[])
     bool set_32bit, set_16bit, set_8bit;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
+              &base, &base_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
+              &len, &len_set, "length");
     init_opts(&opts[2], 'p', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&pat, (bool *)&pat_set, "pattern");
+              &pat, &pat_set, "pattern");
     init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
+              &set_32bit, 0, "fill 32 bit units");
     init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
+              &set_16bit, 0, "fill 16 bit units");
     init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
+              &set_8bit, 0, "fill 8 bit units");
     if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
         return;
     }
Index: packages/redboot/current/src/net/net_io.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/net/net_io.c,v
retrieving revision 1.4
diff -u -B -p -r1.4 net_io.c
--- packages/redboot/current/src/net/net_io.c	3 Sep 2003 15:33:26 -0000	1.4
+++ packages/redboot/current/src/net/net_io.c	1 Oct 2003 08:28:15 -0000
@@ -831,15 +831,15 @@ do_ip_addr(int argc, char *argv[])
     int num_opts;
 
     init_opts(&opts[0], 'l', true, OPTION_ARG_TYPE_STR, 
-              (void **)&ip_addr, (bool *)&ip_addr_set, "local IP address");
+              &ip_addr, &ip_addr_set, "local IP address");
     init_opts(&opts[1], 'h', true, OPTION_ARG_TYPE_STR, 
-              (void **)&host_addr, (bool *)&host_addr_set, "default server address");
+              &host_addr, &host_addr_set, "default server address");
     init_opts(&opts[2], 'b', false, OPTION_ARG_TYPE_FLG,
-              (void**)&do_bootp, (bool *)NULL, "use BOOTP");
+              &do_bootp, 0, "use BOOTP");
     num_opts = 3;
 #ifdef CYGPKG_REDBOOT_NETWORKING_DNS
     init_opts(&opts[3], 'd', true, OPTION_ARG_TYPE_STR, 
-              (void **)&dns_addr, (bool *)&dns_addr_set, "DNS server address");
+              &dns_addr, &dns_addr_set, "DNS server address");
     num_opts++;
 #endif
     if (!scan_opts(argc, argv, 1, opts, num_opts, 0, 0, "")) {
Index: packages/redboot/current/src/net/ping.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/net/ping.c,v
retrieving revision 1.1.1.2
diff -u -B -p -r1.1.1.2 ping.c
--- packages/redboot/current/src/net/ping.c	29 Aug 2003 10:11:35 -0000	1.1.1.2
+++ packages/redboot/current/src/net/ping.c	1 Oct 2003 08:28:15 -0000
@@ -110,20 +110,20 @@ do_ping(int argc, char *argv[])
     ip_route_t dest_ip;
 
     init_opts(&opts[0], 'n', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&count, (bool *)&count_set, "<count> - number of packets to test");
+              &count, &count_set, "<count> - number of packets to test");
     init_opts(&opts[1], 't', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&timeout, (bool *)&timeout_set, "<timeout> - max #ms per packet [rount trip]");
+              &timeout, &timeout_set, "<timeout> - max #ms per packet [rount trip]");
     init_opts(&opts[2], 'i', true, OPTION_ARG_TYPE_STR, 
-              (void **)&local_ip_addr, (bool *)&local_ip_addr_set, "local IP address");
+              &local_ip_addr, &local_ip_addr_set, "local IP address");
     init_opts(&opts[3], 'h', true, OPTION_ARG_TYPE_STR, 
-              (void **)&host_ip_addr, (bool *)&host_ip_addr_set, "host name or IP address");
+              &host_ip_addr, &host_ip_addr_set, "host name or IP address");
     init_opts(&opts[4], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "<length> - size of payload");
+              &length, &length_set, "<length> - size of payload");
     init_opts(&opts[5], 'v', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&verbose, (bool *)0, "verbose operation");
+              &verbose, 0, "verbose operation");
     init_opts(&opts[6], 'r', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&rate, (bool *)&rate_set, "<rate> - time between packets");
-    if (!scan_opts(argc, argv, 1, opts, 7, (void **)0, 0, "")) {
+              &rate, &rate_set, "<rate> - time between packets");
+    if (!scan_opts(argc, argv, 1, opts, 7, 0, 0, "")) {
         diag_printf("PING - Invalid option specified\n");
         return;
     }   
Index: packages/hal/i386/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /var/cvs/ecos/packages/hal/i386/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.1
diff -u -B -p -r1.1 redboot_linux_exec.c
--- packages/hal/i386/arch/current/src/redboot_linux_exec.c	29 May 2003 13:26:30 -0000	1.1
+++ packages/hal/i386/arch/current/src/redboot_linux_exec.c	1 Oct 2003 08:32:16 -0000
@@ -104,18 +104,18 @@ do_linux(int argc, char **argv)
 
     ramdisk_size = 4096*1024;
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM,
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
+              &wait_time, &wait_time_set, "wait timeout");
     init_opts(&opts[1], 'b', true, OPTION_ARG_TYPE_NUM,
-              (void **)&base_addr, (bool *)&base_addr_set, "base address");
+              &base_addr, &base_addr_set, "base address");
     init_opts(&opts[2], 'l', true, OPTION_ARG_TYPE_NUM,
-              (void **)&length, (bool *)&length_set, "length");
+              &length, &length_set, "length");
     init_opts(&opts[3], 'c', true, OPTION_ARG_TYPE_STR,
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
+              &cmd_line, &cmd_line_set, "kernel command line");
     init_opts(&opts[4], 'r', true, OPTION_ARG_TYPE_NUM,
-              (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr");
+              &ramdisk_addr, &ramdisk_addr_set, "ramdisk_addr");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM,
-              (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size");
-    if (!scan_opts(argc, argv, 1, opts, 6, NULL, 0, "starting address"))
+              &ramdisk_size, &ramdisk_size_set, "ramdisk_size");
+    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "starting address"))
     {
         return;
     }
Index: packages/hal/arm/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /var/cvs/ecos/packages/hal/arm/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.2
diff -u -B -p -r1.2 redboot_linux_exec.c
--- packages/hal/arm/arch/current/src/redboot_linux_exec.c	25 Sep 2003 13:43:05 -0000	1.2
+++ packages/hal/arm/arch/current/src/redboot_linux_exec.c	1 Oct 2003 08:44:57 -0000
@@ -303,20 +303,20 @@ do_exec(int argc, char *argv[])
 
     ramdisk_size = 4096*1024;
     init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
+              &wait_time, &wait_time_set, "wait timeout");
     init_opts(&opts[1], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base_addr, (bool *)&base_addr_set, "base address");
+              &base_addr, &base_addr_set, "base address");
     init_opts(&opts[2], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&length, (bool *)&length_set, "length");
+              &length, &length_set, "length");
     init_opts(&opts[3], 'c', true, OPTION_ARG_TYPE_STR, 
-              (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
+              &cmd_line, &cmd_line_set, "kernel command line");
     init_opts(&opts[4], 'r', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr");
+              &ramdisk_addr, &ramdisk_addr_set, "ramdisk_addr");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size");
+              &ramdisk_size, &ramdisk_size_set, "ramdisk_size");
     init_opts(&opts[6], 't', true, OPTION_ARG_TYPE_NUM,
-              (void **)&target, NULL, "[physical] target address");
-    if (!scan_opts(argc, argv, 1, opts, 7, (void *)&entry, OPTION_ARG_TYPE_NUM, "[physical] starting address"))
+              &target, 0, "[physical] target address");
+    if (!scan_opts(argc, argv, 1, opts, 7, &entry, OPTION_ARG_TYPE_NUM, "[physical] starting address"))
     {
         return;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]