refactor dump_hex to drop some redundant code

This commit is contained in:
Klas Lindfors
2015-03-18 15:04:19 +01:00
parent cd1410a950
commit 0f26a7c1e3
3 changed files with 10 additions and 20 deletions
+3 -2
View File
@@ -144,11 +144,12 @@ parse_err:
return NULL;
}
void dump_hex(const unsigned char *buf, unsigned int len) {
void dump_hex(const unsigned char *buf, unsigned int len, FILE *output, bool space) {
unsigned int i;
for (i = 0; i < len; i++) {
fprintf(stderr, "%02x ", buf[i]);
fprintf(output, "%02x%s", buf[i], space == true ? " " : "");
}
fprintf(output, "\n");
}
int get_length(const unsigned char *buffer, int *len) {