OSDN Git Service

android: Use G_N_ELEMENTS macro for table elements calculation
authorSzymon Janc <szymon.janc@tieto.com>
Mon, 2 Dec 2013 15:17:58 +0000 (16:17 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 3 Dec 2013 11:44:04 +0000 (13:44 +0200)
It is more common in codebase to use this macro instead of opencoded
(sizeof(foo)/sizeof(foo[0])).

android/a2dp.c
android/bluetooth.c
android/hidhost.c
android/main.c
android/pan.c
android/socket.c

index 98c138e..cee4bfa 100644 (file)
@@ -377,7 +377,7 @@ bool bt_a2dp_register(const bdaddr_t *addr)
        record_id = rec->handle;
 
        ipc_register(HAL_SERVICE_ID_A2DP, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 
        return true;
 }
index a39e7bf..6174b1f 100644 (file)
@@ -2418,7 +2418,7 @@ void bt_bluetooth_register(void)
        DBG("");
 
        ipc_register(HAL_SERVICE_ID_BLUETOOTH, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 }
 
 void bt_bluetooth_unregister(void)
index 38194d0..8bfdfed 100644 (file)
@@ -1279,7 +1279,7 @@ bool bt_hid_register(const bdaddr_t *addr)
        }
 
        ipc_register(HAL_SERVICE_ID_HIDHOST, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 
        return true;
 }
index b9655c5..5210b4b 100644 (file)
@@ -430,7 +430,7 @@ int main(int argc, char *argv[])
        start_sdp_server(0, 0);
 
        ipc_register(HAL_SERVICE_ID_CORE, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 
        DBG("Entering main loop");
 
index 3270aa4..fe6ee26 100644 (file)
@@ -322,7 +322,7 @@ bool bt_pan_register(const bdaddr_t *addr)
        }
 
        ipc_register(HAL_SERVICE_ID_PAN, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 
        return true;
 }
index 76b40c8..c9eca44 100644 (file)
@@ -929,7 +929,7 @@ void bt_socket_register(const bdaddr_t *addr)
 
        bacpy(&adapter_addr, addr);
        ipc_register(HAL_SERVICE_ID_SOCK, cmd_handlers,
-                               sizeof(cmd_handlers)/sizeof(cmd_handlers[0]));
+                                               G_N_ELEMENTS(cmd_handlers));
 }
 
 void bt_socket_unregister(void)