summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-06-22 07:29:56 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-06-22 07:29:56 +0000
commit008613a7b11c2f9084ca6a1525a5367b6fc6dfa7 (patch)
treeab9ea2f3c3fdb8722f7feaa67e8063cb1f3f5cee /hcid
parent85330d203f2ec30d6e46ad91087dcd20a051be9e (diff)
Make use of bachk() function
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-common.c39
-rw-r--r--hcid/dbus-common.h2
2 files changed, 1 insertions, 40 deletions
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c
index 5e7d0888..3df3d4d1 100644
--- a/hcid/dbus-common.c
+++ b/hcid/dbus-common.c
@@ -207,45 +207,6 @@ failed:
return 0;
}
-
-int check_address(const char *addr)
-{
- char tmp[18];
- char *ptr = tmp;
-
- if (!addr)
- return -1;
-
- if (strlen(addr) != 17)
- return -1;
-
- memcpy(tmp, addr, 18);
-
- while (*ptr) {
-
- *ptr = toupper(*ptr);
- if (*ptr < '0'|| (*ptr > '9' && *ptr < 'A') || *ptr > 'F')
- return -1;
-
- ptr++;
- *ptr = toupper(*ptr);
- if (*ptr < '0'|| (*ptr > '9' && *ptr < 'A') || *ptr > 'F')
- return -1;
-
- ptr++;
- *ptr = toupper(*ptr);
- if (*ptr == 0)
- break;
-
- if (*ptr != ':')
- return -1;
-
- ptr++;
- }
-
- return 0;
-}
-
void hcid_dbus_set_experimental(void)
{
experimental = 1;
diff --git a/hcid/dbus-common.h b/hcid/dbus-common.h
index 98513ea0..d1bc1683 100644
--- a/hcid/dbus-common.h
+++ b/hcid/dbus-common.h
@@ -49,7 +49,7 @@ int l2raw_connect(const char *local, const bdaddr_t *remote);
int find_conn(int s, int dev_id, long arg);
-int check_address(const char *addr);
+#define check_address(address) bachk(address)
DBusHandlerResult handle_method_call(DBusConnection *conn, DBusMessage *msg, void *data);