diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-27 09:52:14 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-27 09:52:14 -0700 |
commit | 1864f2b396f501738a104d427a28545beb8a3c33 (patch) | |
tree | ee384871fb834afcfb9a78f05bbbc09ab93249ac | |
parent | 8eb76e46a807cfbca1f5b756f6b1955f203617ce (diff) | |
parent | 52a11813a607c662847a1ef052ef914417145101 (diff) |
Merge pull request #118 from nfkd/patch-1
styling
-rw-r--r-- | testing/misc_tools.c | 13 |
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 */ |
31 | unsigned char * hex_string_to_bin(char hex_string[]) | 31 | unsigned 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 | } |