OSDN Git Service

core: Use local assert function where possible
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 8 Nov 2015 13:57:40 +0000 (14:57 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 8 Nov 2015 13:57:40 +0000 (14:57 +0100)
src/attrib-server.c
src/service.c

index 0f2cced..4439c27 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "btio/btio.h"
 #include "log.h"
+#include "backtrace.h"
 #include "adapter.h"
 #include "device.h"
 #include "src/shared/util.h"
@@ -1521,7 +1522,7 @@ static uint16_t find_uuid128_avail(struct btd_adapter *adapter, uint16_t nitems)
 uint16_t attrib_db_find_avail(struct btd_adapter *adapter, bt_uuid_t *svc_uuid,
                                                                uint16_t nitems)
 {
-       g_assert(nitems > 0);
+       btd_assert(nitems > 0);
 
        if (svc_uuid->type == BT_UUID16)
                return find_uuid16_avail(adapter, nitems);
index 7da922c..3d07744 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdbool.h>
@@ -41,6 +40,7 @@
 #include "lib/sdp.h"
 
 #include "log.h"
+#include "backtrace.h"
 
 #include "adapter.h"
 #include "device.h"
@@ -92,8 +92,8 @@ static void change_state(struct btd_service *service, btd_service_state_t state,
        if (state == old)
                return;
 
-       assert(service->device != NULL);
-       assert(service->profile != NULL);
+       btd_assert(service->device != NULL);
+       btd_assert(service->profile != NULL);
 
        service->state = state;
        service->err = err;
@@ -155,7 +155,7 @@ int service_probe(struct btd_service *service)
        char addr[18];
        int err;
 
-       assert(service->state == BTD_SERVICE_STATE_UNAVAILABLE);
+       btd_assert(service->state == BTD_SERVICE_STATE_UNAVAILABLE);
 
        err = service->profile->device_probe(service);
        if (err == 0) {
@@ -299,7 +299,7 @@ struct btd_profile *btd_service_get_profile(const struct btd_service *service)
 
 void btd_service_set_user_data(struct btd_service *service, void *user_data)
 {
-       assert(service->state == BTD_SERVICE_STATE_UNAVAILABLE);
+       btd_assert(service->state == BTD_SERVICE_STATE_UNAVAILABLE);
        service->user_data = user_data;
 }