improve str_to_buf and buf_to_str helpers

Improve types: use void * and unsigned.  Move all variables to point of
first use.  Move radix guessing logic to new str_radix_guess helper.
This commit is contained in:
Zachary T Welch
2009-11-14 10:14:04 -08:00
parent 5a43bd2e18
commit d50caa97d1
2 changed files with 67 additions and 65 deletions

View File

@@ -79,9 +79,9 @@ uint8_t* buf_set_ones(uint8_t *buf, int count);
uint8_t* buf_set_buf(const uint8_t *src, int src_start,
uint8_t *dst, int dst_start, int len);
int str_to_buf(const char *str, int len,
uint8_t *bin_buf, int buf_size, int radix);
char* buf_to_str(const uint8_t *buf, int size, int radix);
int str_to_buf(const char *str, unsigned len,
void *bin_buf, unsigned buf_size, unsigned radix);
char* buf_to_str(const void *buf, unsigned size, unsigned radix);
#define CEIL(m, n) (((m) + (n) - 1) / (n))