Update module names to not use C preprocessor and to be at top of headers.
diff --git a/btcore/include/counter.h b/btcore/include/counter.h
index d829517..10e384f 100644
--- a/btcore/include/counter.h
+++ b/btcore/include/counter.h
@@ -21,7 +21,7 @@
#include <stdbool.h>
#include <stdint.h>
-#define COUNTER_MODULE "counter_module"
+static const char COUNTER_MODULE[] = "counter_module";
typedef int64_t counter_data_t;
diff --git a/btcore/include/module.h b/btcore/include/module.h
index 1d5bea9..d88f5f3 100644
--- a/btcore/include/module.h
+++ b/btcore/include/module.h
@@ -26,7 +26,7 @@
typedef future_t *(*module_lifecycle_fn)(void);
typedef struct {
- char *name;
+ const char *name;
module_lifecycle_fn init;
module_lifecycle_fn start_up;
module_lifecycle_fn shut_down;
diff --git a/btif/include/btif_config.h b/btif/include/btif_config.h
index f72fdfb..30f5f5b 100644
--- a/btif/include/btif_config.h
+++ b/btif/include/btif_config.h
@@ -23,9 +23,9 @@
#include "bt_types.h"
-typedef struct btif_config_section_iter_t btif_config_section_iter_t;
+static const char BTIF_CONFIG_MODULE[] = "btif_config_module";
-#define BTIF_CONFIG_MODULE "btif_config_module"
+typedef struct btif_config_section_iter_t btif_config_section_iter_t;
bool btif_config_has_section(const char *section);
bool btif_config_exist(const char *section, const char *key);
diff --git a/device/include/controller.h b/device/include/controller.h
index fce6953..2ef2332 100644
--- a/device/include/controller.h
+++ b/device/include/controller.h
@@ -27,6 +27,8 @@
#include "hci_packet_factory.h"
#include "hci_packet_parser.h"
+static const char CONTROLLER_MODULE[] = "controller_module";
+
typedef struct controller_t {
bool (*get_is_ready)(void);
@@ -65,7 +67,6 @@
uint8_t (*get_acl_buffer_count_ble)(void);
} controller_t;
-#define CONTROLLER_MODULE "controller_module"
const controller_t *controller_get_interface();
const controller_t *controller_get_test_interface(
diff --git a/gki/common/gki.h b/gki/common/gki.h
index 40e9d86..7e719c1 100644
--- a/gki/common/gki.h
+++ b/gki/common/gki.h
@@ -21,6 +21,8 @@
#include "bt_target.h"
#include "bt_types.h"
+static const char GKI_MODULE[] = "gki_module";
+
/* Error codes */
#define GKI_SUCCESS 0x00
#define GKI_FAILURE 0x01
@@ -128,8 +130,6 @@
** Function prototypes
*/
-#define GKI_MODULE "gki_module"
-
/* Task management
*/
UINT8 GKI_get_taskid(void);
diff --git a/hci/include/btsnoop.h b/hci/include/btsnoop.h
index 49df9ee..14fbf72 100644
--- a/hci/include/btsnoop.h
+++ b/hci/include/btsnoop.h
@@ -22,6 +22,8 @@
#include "bt_types.h"
+static const char BTSNOOP_MODULE[] = "btsnoop_module";
+
typedef struct btsnoop_t {
// Inform btsnoop whether the API desires to log. If |value| is true.
// logging will be enabled. Otherwise it defers to the value from the
@@ -34,5 +36,4 @@
void (*capture)(const BT_HDR *packet, bool is_received);
} btsnoop_t;
-#define BTSNOOP_MODULE "btsnoop_module"
-const btsnoop_t *btsnoop_get_interface();
+const btsnoop_t *btsnoop_get_interface(void);
diff --git a/hci/include/hci_layer.h b/hci/include/hci_layer.h
index 7c2be62..810e0b8 100644
--- a/hci/include/hci_layer.h
+++ b/hci/include/hci_layer.h
@@ -26,6 +26,8 @@
#include "future.h"
#include "osi.h"
+static const char HCI_MODULE[] = "hci_module";
+
///// LEGACY DEFINITIONS /////
/* Message event mask across Host/Controller lib and stack */
@@ -94,7 +96,6 @@
void (*transmit_downward)(data_dispatcher_type_t type, void *data);
} hci_t;
-#define HCI_MODULE "hci_module"
const hci_t *hci_layer_get_interface();
const hci_t *hci_layer_get_test_interface(
diff --git a/include/bt_trace.h b/include/bt_trace.h
index 62afb19..13942d4 100644
--- a/include/bt_trace.h
+++ b/include/bt_trace.h
@@ -18,7 +18,7 @@
#pragma once
-#define BTE_LOGMSG_MODULE "bte_logmsg_module"
+static const char BTE_LOGMSG_MODULE[] = "bte_logmsg_module";
/* BTE tracing IDs for debug purposes */
/* LayerIDs for stack */
diff --git a/include/stack_config.h b/include/stack_config.h
index 5da6926..d2f89c9 100644
--- a/include/stack_config.h
+++ b/include/stack_config.h
@@ -23,6 +23,8 @@
#include "config.h"
#include "module.h"
+static const char STACK_CONFIG_MODULE[] = "stack_config_module";
+
typedef struct {
const char *(*get_btsnoop_log_path)(void);
bool (*get_btsnoop_turned_on)(void);
@@ -30,5 +32,4 @@
config_t *(*get_all)(void);
} stack_config_t;
-#define STACK_CONFIG_MODULE "stack_config_module"
const stack_config_t *stack_config_get_interface();
diff --git a/utils/include/bt_utils.h b/utils/include/bt_utils.h
index 7c112ce..fa397f9 100644
--- a/utils/include/bt_utils.h
+++ b/utils/include/bt_utils.h
@@ -19,6 +19,8 @@
#ifndef BT_UTILS_H
#define BT_UTILS_H
+static const char BT_UTILS_MODULE[] = "bt_utils_module";
+
/*******************************************************************************
** Type definitions
********************************************************************************/
@@ -38,7 +40,6 @@
** Functions
********************************************************************************/
-#define BT_UTILS_MODULE "bt_utils_module"
void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task);
void adjust_priority_a2dp(int start);
#define UNUSED(x) (void)(x)