From 7e5f460ec457fe310156e399198a41eb0ce1e98c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:29 -0600 Subject: global: Convert simple_strtoul() with hex to hextoul() It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass --- cmd/binop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/binop.c') diff --git a/cmd/binop.c b/cmd/binop.c index c85cb51568d..bb5adc3e05f 100644 --- a/cmd/binop.c +++ b/cmd/binop.c @@ -58,7 +58,7 @@ void write_to_mem(char *varname, u8 *result, ulong len) ulong addr; u8 *buf; - addr = simple_strtoul(varname, NULL, 16); + addr = hextoul(varname, NULL); buf = map_sysmem(addr, len); memcpy(buf, result, len); unmap_sysmem(buf); @@ -95,12 +95,12 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc, src2 = malloc(len); if (*src1arg == '*') - read_from_mem(simple_strtoul(src1arg + 1, NULL, 16), src1, len); + read_from_mem(hextoul(src1arg + 1, NULL), src1, len); else read_from_env_var(src1arg, src1); if (*src2arg == '*') - read_from_mem(simple_strtoul(src2arg + 1, NULL, 16), src2, len); + read_from_mem(hextoul(src2arg + 1, NULL), src2, len); else read_from_env_var(src2arg, src2); -- cgit v1.2.3 From 0b1284eb52578e15ec611adc5fee1a9ae68dadea Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:30 -0600 Subject: global: Convert simple_strtoul() with decimal to dectoul() It is a pain to have to specify the value 10 in each call. Add a new dectoul() function and update the code to use it. Signed-off-by: Simon Glass --- cmd/binop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/binop.c') diff --git a/cmd/binop.c b/cmd/binop.c index bb5adc3e05f..592e9146901 100644 --- a/cmd/binop.c +++ b/cmd/binop.c @@ -89,7 +89,7 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc, else return CMD_RET_USAGE; - len = simple_strtoul(lenarg, NULL, 10); + len = dectoul(lenarg, NULL); src1 = malloc(len); src2 = malloc(len); -- cgit v1.2.3