summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2008-09-14 12:24:43 -0700
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-09-14 12:31:23 -0700
commit60af857dbc8a258eb91ef3fb6de06c17c8fb4ec2 (patch)
tree4641fcf1d053b05d3c82a550799ae2742ad64e61
parentc5dd9adb104b44a4ebb9006fb3205b7c74c3beb5 (diff)
rename get_record() to find_record_in_list() and move to storage.[ch]
-rw-r--r--src/device.c32
-rw-r--r--src/storage.c29
-rw-r--r--src/storage.h1
3 files changed, 31 insertions, 31 deletions
diff --git a/src/device.c b/src/device.c
index c9d1d310..7a06cd14 100644
--- a/src/device.c
+++ b/src/device.c
@@ -562,34 +562,6 @@ gint device_address_cmp(struct btd_device *device, const gchar *address)
return strcasecmp(addr, address);
}
-sdp_record_t *get_record(sdp_list_t *recs, const char *uuid)
-{
- sdp_list_t *seq;
-
- for (seq = recs; seq; seq = seq->next) {
- sdp_record_t *rec = (sdp_record_t *) seq->data;
- sdp_list_t *svcclass = NULL;
- char *uuid_str;
-
- if (sdp_get_service_classes(rec, &svcclass) < 0)
- continue;
-
- /* Extract the uuid */
- uuid_str = bt_uuid2string(svcclass->data);
- if (!uuid_str)
- continue;
-
- if (!strcasecmp(uuid_str, uuid)) {
- sdp_list_free(svcclass, free);
- free(uuid_str);
- return rec;
- }
- sdp_list_free(svcclass, free);
- free(uuid_str);
- }
- return NULL;
-}
-
void device_probe_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *recs)
{
GSList *list;
@@ -609,7 +581,7 @@ void device_probe_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *
(GCompareFunc) strcasecmp))
continue;
- rec = get_record(recs, *uuid);
+ rec = find_record_in_list(recs, *uuid);
if (!rec)
continue;
@@ -670,7 +642,7 @@ void device_remove_drivers(struct btd_device *device, GSList *uuids, sdp_list_t
g_free(driver_data);
- rec = get_record(recs, *uuid);
+ rec = find_record_in_list(recs, *uuid);
if (!rec)
continue;
diff --git a/src/storage.c b/src/storage.c
index fc0f15d4..c951f0f2 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -45,7 +45,7 @@
#include <bluetooth/sdp_lib.h>
#include "textfile.h"
-
+#include "glib-helper.h"
static inline int create_filename(char *buf, size_t size, const bdaddr_t *bdaddr, const char *name)
{
char addr[18];
@@ -854,6 +854,33 @@ sdp_list_t *read_records(const gchar *src, const gchar *dst)
return rec_list.recs;
}
+sdp_record_t *find_record_in_list(sdp_list_t *recs, const char *uuid)
+{
+ sdp_list_t *seq;
+
+ for (seq = recs; seq; seq = seq->next) {
+ sdp_record_t *rec = (sdp_record_t *) seq->data;
+ sdp_list_t *svcclass = NULL;
+ char *uuid_str;
+
+ if (sdp_get_service_classes(rec, &svcclass) < 0)
+ continue;
+
+ /* Extract the uuid */
+ uuid_str = bt_uuid2string(svcclass->data);
+ if (!uuid_str)
+ continue;
+
+ if (!strcasecmp(uuid_str, uuid)) {
+ sdp_list_free(svcclass, free);
+ free(uuid_str);
+ return rec;
+ }
+ sdp_list_free(svcclass, free);
+ free(uuid_str);
+ }
+ return NULL;
+}
int store_device_id(const gchar *src, const gchar *dst,
const uint16_t source, const uint16_t vendor,
diff --git a/src/storage.h b/src/storage.h
index 85d1064c..adfc420b 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -60,6 +60,7 @@ int store_record(const gchar *src, const gchar *dst, sdp_record_t *rec);
sdp_record_t *fetch_record(const gchar *src, const gchar *dst, const uint32_t handle);
int delete_record(const gchar *src, const gchar *dst, const uint32_t handle);
sdp_list_t *read_records(const gchar *src, const gchar *dst);
+sdp_record_t *find_record_in_list(sdp_list_t *recs, const char *uuid);
int store_device_id(const gchar *src, const gchar *dst,
const uint16_t source, const uint16_t vendor,
const uint16_t product, const uint16_t version);