command: Add constants for cmd_get_data_size string / error
At present these values are open-coded in a few places. Add constants so
the meaning is clear.
Also add a comment to cmd_get_data_size()
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/cmd/itest.c b/cmd/itest.c
index a0cf4be..9a441ce 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -197,10 +197,10 @@
#endif
value = binary_test (argv[2], argv[1], argv[3], w);
break;
- case -2:
+ case CMD_DATA_SIZE_STR:
value = binary_test (argv[2], argv[1], argv[3], 0);
break;
- case -1:
+ case CMD_DATA_SIZE_ERR:
default:
puts("Invalid data width specifier\n");
value = 0;
diff --git a/cmd/mem.c b/cmd/mem.c
index 56e1d07..1d4f2ba 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -393,7 +393,7 @@
* Defaults to long if no or incorrect specification.
*/
size = cmd_get_data_size(argv[0], 4);
- if (size < 0 && size != -2 /* string */)
+ if (size < 0 && size != CMD_DATA_SIZE_STR)
return 1;
argc--;