From 27b1a24993431d4c749a5cc526ceb87a35012881 Mon Sep 17 00:00:00 2001 From: Vinayak Chettimada Date: Tue, 15 Nov 2016 17:13:52 +0100 Subject: [PATCH] Bluetooth: Controller: Remove unused util functions Change-id: I7b691d082d080239c35b63221e3c6c7aa93ed58e Signed-off-by: Vinayak Chettimada --- subsys/bluetooth/controller/util/util.c | 97 ------------------------- subsys/bluetooth/controller/util/util.h | 3 - 2 files changed, 100 deletions(-) diff --git a/subsys/bluetooth/controller/util/util.c b/subsys/bluetooth/controller/util/util.c index 401b0f3dc09..759382af269 100644 --- a/subsys/bluetooth/controller/util/util.c +++ b/subsys/bluetooth/controller/util/util.c @@ -18,103 +18,6 @@ #include #include "util.h" -/* Convert the integer D to a string and save the string in BUF. If - * BASE is equal to 'd', interpret that D is decimal, and if BASE is - * equal to 'x', interpret that D is hexadecimal. - */ -void util_itoa(char *buf, int base, int d) -{ - char *p = buf; - char *p1, *p2; - unsigned long ud = d; - int divisor = 10; - - /* If %d is specified and D is minus, put `-' in the head. */ - if (base == 'd' && d < 0) { - *p++ = '-'; - buf++; - ud = -d; - } else if (base == 'x') - divisor = 16; - - /* Divide UD by DIVISOR until UD == 0. */ - do { - int remainder = ud % divisor; - *p++ = - (remainder < 10) ? remainder + '0' : remainder + 'a' - 10; - } while (ud /= divisor); - - /* Terminate BUF. */ - *p = 0; - - /* Reverse BUF. */ - p1 = buf; - p2 = p - 1; - while (p1 < p2) { - char tmp = *p1; - *p1 = *p2; - *p2 = tmp; - p1++; - p2--; - } -} - -int util_atoi(char *s) -{ - int val = 0; - - while (*s) { - if (*s < '0' || *s > '9') - return val; - val = (val * 10) + (*s - '0'); - s++; - } - return val; -} - -/* Format a string and print it on the screen, just like the libc - * function printf. - */ -void util_sprintf(char *str, const char *format, ...) -{ - char **arg = (char **)&format; - int c; - char buf[20]; - - arg++; - - while ((c = *format++)) { - if (c != '%') - *str++ = c; - else { - char *p; - - c = *format++; - switch (c) { - case 'd': - case 'u': - case 'x': - util_itoa(buf, c, *((int *)arg++)); - p = buf; - goto string; - case 's': - p = *arg++; - if (!p) - p = "(null)"; -string: - while (*p) - *str++ = *p++; - break; - default: - *str++ = (*((int *)arg++)); - break; - } - } - } - - *str = 0; -} - uint8_t util_ones_count_get(uint8_t *octets, uint8_t octets_len) { uint8_t one_count = 0; diff --git a/subsys/bluetooth/controller/util/util.h b/subsys/bluetooth/controller/util/util.h index 1a5e55a6222..e61bace1c46 100644 --- a/subsys/bluetooth/controller/util/util.h +++ b/subsys/bluetooth/controller/util/util.h @@ -18,9 +18,6 @@ #ifndef _UTIL_H_ #define _UTIL_H_ -void util_itoa(char *buf, int base, int d); -int util_atoi(char *s); -void util_sprintf(char *str, const char *format, ...); uint8_t util_ones_count_get(uint8_t *octets, uint8_t octets_len); #endif