summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-30 11:40:32 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-30 11:40:32 +0200
commit40481e895453c53d71f2f254b931b77c830c9e0a (patch)
tree4699953396361534765d34db3cdf37b690fac6b3
parent3eba991b3d005c3ae4aafe2235558a60e06b49f4 (diff)
move hexdump() from logging.c to utils.c
-rw-r--r--include/osmocore/logging.h1
-rw-r--r--include/osmocore/utils.h1
-rw-r--r--src/logging.c19
-rw-r--r--src/rsl.c1
-rw-r--r--src/utils.c19
5 files changed, 21 insertions, 20 deletions
diff --git a/include/osmocore/logging.h b/include/osmocore/logging.h
index 2e82959a..7bf24403 100644
--- a/include/osmocore/logging.h
+++ b/include/osmocore/logging.h
@@ -21,7 +21,6 @@
#define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
-char *hexdump(const unsigned char *buf, int len);
void logp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
/* new logging interface */
diff --git a/include/osmocore/utils.h b/include/osmocore/utils.h
index c5b95bd3..07af1802 100644
--- a/include/osmocore/utils.h
+++ b/include/osmocore/utils.h
@@ -18,5 +18,6 @@ char bcd2char(uint8_t bcd);
uint8_t char2bcd(char c);
int hexparse(const char *str, uint8_t *b, int max_len);
+char *hexdump(const unsigned char *buf, int len);
#endif
diff --git a/src/logging.c b/src/logging.c
index 1dc30db3..2cc44e79 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -236,25 +236,6 @@ void logp2(unsigned int subsys, unsigned int level, char *file, int line, int co
va_end(ap);
}
-static char hexd_buff[4096];
-
-char *hexdump(const unsigned char *buf, int len)
-{
- int i;
- char *cur = hexd_buff;
-
- hexd_buff[0] = 0;
- for (i = 0; i < len; i++) {
- int len_remain = sizeof(hexd_buff) - (cur - hexd_buff);
- int rc = snprintf(cur, len_remain, "%02x ", buf[i]);
- if (rc <= 0)
- break;
- cur += rc;
- }
- hexd_buff[sizeof(hexd_buff)-1] = 0;
- return hexd_buff;
-}
-
void log_add_target(struct log_target *target)
{
llist_add_tail(&target->entry, &target_list);
diff --git a/src/rsl.c b/src/rsl.c
index 10fba9b2..3bfeffb9 100644
--- a/src/rsl.c
+++ b/src/rsl.c
@@ -22,6 +22,7 @@
*/
#include <stdint.h>
+#include <stdio.h>
#include <errno.h>
#include <osmocore/tlv.h>
diff --git a/src/utils.c b/src/utils.c
index 05381c8b..a6c2d6d2 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -75,3 +75,22 @@ int hexparse(const char *str, uint8_t *b, int max_len)
return i>>1;
}
+
+static char hexd_buff[4096];
+
+char *hexdump(const unsigned char *buf, int len)
+{
+ int i;
+ char *cur = hexd_buff;
+
+ hexd_buff[0] = 0;
+ for (i = 0; i < len; i++) {
+ int len_remain = sizeof(hexd_buff) - (cur - hexd_buff);
+ int rc = snprintf(cur, len_remain, "%02x ", buf[i]);
+ if (rc <= 0)
+ break;
+ cur += rc;
+ }
+ hexd_buff[sizeof(hexd_buff)-1] = 0;
+ return hexd_buff;
+}