summaryrefslogtreecommitdiff
path: root/testing/misc_tools.c
diff options
context:
space:
mode:
authornfkd <nfkd@koszmial.pl>2013-07-27 13:43:30 -0300
committernfkd <nfkd@koszmial.pl>2013-07-27 13:43:30 -0300
commit52a11813a607c662847a1ef052ef914417145101 (patch)
treeee384871fb834afcfb9a78f05bbbc09ab93249ac /testing/misc_tools.c
parent8eb76e46a807cfbca1f5b756f6b1955f203617ce (diff)
styling
Diffstat (limited to 'testing/misc_tools.c')
-rw-r--r--testing/misc_tools.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index 34d64bf4..dbaa8b3b 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -25,19 +25,16 @@
25 25
26#include <string.h> 26#include <string.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <stdio.h> //for sscanf 28#include <stdio.h> /* for sscanf */
29 29
30//TODO: rewrite 30/* TODO: rewrite */
31unsigned char * hex_string_to_bin(char hex_string[]) 31unsigned char * hex_string_to_bin(char hex_string[])
32{ 32{
33 size_t len = strlen(hex_string); 33 size_t len = strlen(hex_string);
34 unsigned char *val = malloc(len); 34 unsigned char *val = malloc(len);
35 char *pos = hex_string; 35 char *pos = hex_string;
36 int i=0; 36 int i;
37 while(i < len) { 37 for(i = 0; i < len; ++i, pos+=2)
38 sscanf(pos,"%2hhx",&val[i]); 38 sscanf(pos,"%2hhx",&val[i]);
39 pos+=2;
40 i++;
41 }
42 return val; 39 return val;
43} \ No newline at end of file 40}