diff options
| -rw-r--r-- | include/hex_conversion.h | 14 | ||||
| -rw-r--r-- | src/mem_internal_check.c | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/hex_conversion.h b/include/hex_conversion.h index 540472d..bb0fab1 100644 --- a/include/hex_conversion.h +++ b/include/hex_conversion.h @@ -16,6 +16,7 @@ int convert_line(char *s); int ishex(unsigned char c); +int ishex_string(const char *s, size_t l); unsigned char *convert_to_binary(char *hex, unsigned char *out); char *convert_from_binary(unsigned char *bin, size_t l, char *out); @@ -42,6 +43,19 @@ inline int ishex(unsigned char c) { return 0; }; +inline int ishex_string(const char *s, size_t l) { + size_t i = 0; + if (s == 0) + return 0; + if (l == 0) + l = strlen(s); + for (; i<l; i++) { + if ( ! ishex_macro(s[i]) ) + return 0; + } + return 1; +} + inline unsigned char *convert_to_binary(char *hex, unsigned char *out) { char tmp[3] = {0,0,0}; size_t length, i; diff --git a/src/mem_internal_check.c b/src/mem_internal_check.c index ecbbd05..ac881b9 100644 --- a/src/mem_internal_check.c +++ b/src/mem_internal_check.c @@ -35,8 +35,8 @@ struct data_field { + unsigned char data[FULL_DATABLOCK_SIZE]; /* keep this as first element for bsearch */ bool active; - unsigned char data[FULL_DATABLOCK_SIZE]; }; struct list_node { @@ -530,7 +530,7 @@ bool verify_data_array(struct data_array *da) { bool res = true; size_t p = 0; int repeated_error = 0; - + if (da == NULL) { LOGERR("No array given...\n"); return false; |
