diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2011-03-04 19:34:05 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-03-15 15:13:52 +0200 |
commit | 2854ecff1ffa1af743e9df8e3fe4cef68750c964 (patch) | |
tree | 011d3a532e0c7954c14d81863296db9e3eefa371 | |
parent | 1c58c18eaaebce43528617fdd439a4ccf56e1496 (diff) | |
download | bluez-2854ecff1ffa1af743e9df8e3fe4cef68750c964.tar.gz |
Make strtoba use str2ba for string conversion
-rw-r--r-- | lib/bluetooth.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/bluetooth.c b/lib/bluetooth.c index a1b4c13b6..72ee456f8 100644 --- a/lib/bluetooth.c +++ b/lib/bluetooth.c @@ -63,21 +63,15 @@ char *batostr(const bdaddr_t *ba) bdaddr_t *strtoba(const char *str) { - const char *ptr = str; - int i; - - uint8_t *ba = bt_malloc(sizeof(bdaddr_t)); - if (!ba) - return NULL; + bdaddr_t b; + bdaddr_t *ba = bt_malloc(sizeof(*ba)); - for (i = 0; i < 6; i++) { - ba[i] = (uint8_t) strtol(ptr, NULL, 16); - if (i != 5 && !(ptr = strchr(ptr,':'))) - ptr = ":00:00:00:00:00"; - ptr++; + if (ba) { + str2ba(str, &b); + baswap(ba, &b); } - return (bdaddr_t *) ba; + return ba; } int ba2str(const bdaddr_t *ba, char *str) |