diff options
author | Travis Geiselbrecht <geist@foobox.com> | 2015-10-19 12:46:31 -0700 |
---|---|---|
committer | Travis Geiselbrecht <geist@foobox.com> | 2015-10-19 12:49:20 -0700 |
commit | 38f20ec0a164aab2db996f29baa1f553d22ea97a (patch) | |
tree | 9ac4cce3bc1286bd7dfa4866631bbb50a2ca85f2 | |
parent | fab92f3179b2ce18e967c946a2ccdc1123a118b3 (diff) | |
download | common-38f20ec0a164aab2db996f29baa1f553d22ea97a.tar.gz |
[lib][console] add pointer type arg, switch some users to it.
Patch courtesy Erik Corry
-rw-r--r-- | app/tests/mem_tests.c | 2 | ||||
-rw-r--r-- | include/lib/console.h | 1 | ||||
-rw-r--r-- | lib/buildsig/buildsig.c | 2 | ||||
-rw-r--r-- | lib/cksum/debug.c | 8 | ||||
-rw-r--r-- | lib/console/console.c | 4 | ||||
-rw-r--r-- | lib/debugcommands/debugcommands.c | 2 | ||||
-rw-r--r-- | lib/heap/heap_wrapper.c | 2 | ||||
-rw-r--r-- | platform/zynq/spiflash.c | 2 |
8 files changed, 13 insertions, 10 deletions
diff --git a/app/tests/mem_tests.c b/app/tests/mem_tests.c index fdd14fe1..0b76e646 100644 --- a/app/tests/mem_tests.c +++ b/app/tests/mem_tests.c @@ -225,7 +225,7 @@ usage: free(ptr); #endif } else if (argc == 3) { - void *ptr = (void *)argv[1].u; + void *ptr = argv[1].p; size_t len = argv[2].u; /* run the tests */ diff --git a/include/lib/console.h b/include/lib/console.h index a81aefc4..f270b3fe 100644 --- a/include/lib/console.h +++ b/include/lib/console.h @@ -32,6 +32,7 @@ typedef struct { const char *str; unsigned long u; + void* p; long i; bool b; } cmd_args; diff --git a/lib/buildsig/buildsig.c b/lib/buildsig/buildsig.c index 3436a1a3..54a676f7 100644 --- a/lib/buildsig/buildsig.c +++ b/lib/buildsig/buildsig.c @@ -130,7 +130,7 @@ usage: if (!strcmp(argv[1].str, "dump")) { const void *offset = &__rom_start; if (argc >= 3) { - offset = (void *)argv[2].u; + offset = argv[2].p; } const lk_version_t *v; diff --git a/lib/cksum/debug.c b/lib/cksum/debug.c index 14606d6f..132cc00c 100644 --- a/lib/cksum/debug.c +++ b/lib/cksum/debug.c @@ -56,7 +56,7 @@ static int cmd_crc16(int argc, const cmd_args *argv) return -1; } - uint16_t crc = crc16((void *)argv[1].u, argv[2].u); + uint16_t crc = crc16(argv[1].p, argv[2].u); printf("0x%hx\n", crc); @@ -71,7 +71,7 @@ static int cmd_crc32(int argc, const cmd_args *argv) return -1; } - uint32_t crc = crc32(0, (void *)argv[1].u, argv[2].u); + uint32_t crc = crc32(0, argv[1].p, argv[2].u); printf("0x%x\n", crc); @@ -86,7 +86,7 @@ static int cmd_adler32(int argc, const cmd_args *argv) return -1; } - uint32_t crc = adler32(0, (void *)argv[1].u, argv[2].u); + uint32_t crc = adler32(0, argv[1].p, argv[2].u); printf("0x%x\n", crc); @@ -101,7 +101,7 @@ static int cmd_cksum_bench(int argc, const cmd_args *argv) bool freebuf; if (argc > 1) { - buf = (void *)argv[1].u; + buf = argv[1].p; freebuf = false; } else { buf = malloc(BUFSIZE); diff --git a/lib/console/console.c b/lib/console/console.c index 59514863..bdcab58f 100644 --- a/lib/console/console.c +++ b/lib/console/console.c @@ -538,7 +538,9 @@ static void convert_args(int argc, cmd_args *argv) int i; for (i = 0; i < argc; i++) { - argv[i].u = atoul(argv[i].str); + unsigned long u = atoul(argv[i].str); + argv[i].u = u; + argv[i].p = (void*)u; argv[i].i = atol(argv[i].str); if (!strcmp(argv[i].str, "true") || !strcmp(argv[i].str, "on")) { diff --git a/lib/debugcommands/debugcommands.c b/lib/debugcommands/debugcommands.c index 85df564e..c73ab4e8 100644 --- a/lib/debugcommands/debugcommands.c +++ b/lib/debugcommands/debugcommands.c @@ -306,7 +306,7 @@ static int cmd_chain(int argc, const cmd_args *argv) return -1; } - arch_chain_load((void *)argv[1].u, 0, 0, 0, 0); + arch_chain_load(argv[1].p, 0, 0, 0, 0); return 0; } diff --git a/lib/heap/heap_wrapper.c b/lib/heap/heap_wrapper.c index 071a3586..d2aa6c9e 100644 --- a/lib/heap/heap_wrapper.c +++ b/lib/heap/heap_wrapper.c @@ -300,7 +300,7 @@ usage: } else if (strcmp(argv[1].str, "free") == 0) { if (argc < 2) goto notenoughargs; - heap_free((void *)argv[2].u); + heap_free(argv[2].p); } else { printf("unrecognized command\n"); goto usage; diff --git a/platform/zynq/spiflash.c b/platform/zynq/spiflash.c index 488cf5fd..98b66d8f 100644 --- a/platform/zynq/spiflash.c +++ b/platform/zynq/spiflash.c @@ -526,7 +526,7 @@ usage: return -1; } - status_t err = qspi_write_page(&flash.qspi, argv[2].u, (void *)argv[4].u); + status_t err = qspi_write_page(&flash.qspi, argv[2].u, argv[4].p); printf("write_page returns %d\n", err); } else if (!strcmp(argv[1].str, "erase")) { if (argc < 3) goto notenoughargs; |