From 40d883bd011cba1bfd8588abfb1f5bc1d55b6484 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 27 Mar 2016 22:49:03 +0200 Subject: [PATCH] replace bzero with memset and drop HAVE_BZERO --- port/arduino/btstack_config.h | 1 - port/daemon/configure.ac | 1 - port/ez430-rf2560/btstack_config.h | 1 - port/ios/btstack_config.h | 1 - port/libusb/btstack_config.h | 1 - port/msp-exp430f5438-cc2564b/btstack_config.h | 1 - port/msp430f5229lp-cc2564b/btstack_config.h | 1 - port/mtk/btstack_config.h | 1 - port/nrf5x/btstack_config.h | 1 - port/pic32-harmony/src/btstack_config.h | 1 - port/posix-h4/btstack_config.h | 1 - port/stm32-f103rb-nucleo/btstack_config.h | 1 - port/wiced/btstack_config.h | 1 - test/btstack_config.h | 1 - test/btstack_link_key_db/btstack_config.h | 1 - test/pts/bnep_test.c | 8 ++++---- test/security_manager/aestest.c | 4 ++-- 17 files changed, 6 insertions(+), 21 deletions(-) diff --git a/port/arduino/btstack_config.h b/port/arduino/btstack_config.h index 6645e15bb..d15462a62 100644 --- a/port/arduino/btstack_config.h +++ b/port/arduino/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_TIME_MS // BTstack features that can be enabled diff --git a/port/daemon/configure.ac b/port/daemon/configure.ac index d5dc1af2a..1fbd0d990 100644 --- a/port/daemon/configure.ac +++ b/port/daemon/configure.ac @@ -132,7 +132,6 @@ echo >> btstack_config.h echo "// Port related features" >> btstack_config.h echo "#define HAVE_TIME" >> btstack_config.h echo "#define HAVE_MALLOC" >> btstack_config.h -echo "#define HAVE_BZERO" >> btstack_config.h if test "x$HAVE_SO_NOSIGPIPE" == xyes ; then echo "#define HAVE_SO_NOSIGPIPE" >> btstack_config.h else diff --git a/port/ez430-rf2560/btstack_config.h b/port/ez430-rf2560/btstack_config.h index 23fb2f5e8..57074c6c3 100644 --- a/port/ez430-rf2560/btstack_config.h +++ b/port/ez430-rf2560/btstack_config.h @@ -7,7 +7,6 @@ // Port related features #define HAVE_INIT_SCRIPT -#define HAVE_BZERO #define HAVE_TICK #define HAVE_EHCILL diff --git a/port/ios/btstack_config.h b/port/ios/btstack_config.h index 1df435e8c..20fd52a0a 100644 --- a/port/ios/btstack_config.h +++ b/port/ios/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_MALLOC #define HAVE_PLATFORM_IPHONE_OS #define HAVE_POSIX_FILE_IO diff --git a/port/libusb/btstack_config.h b/port/libusb/btstack_config.h index 1ed4ea532..deeb2c592 100644 --- a/port/libusb/btstack_config.h +++ b/port/libusb/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_MALLOC #define HAVE_SO_NOSIGPIPE #define HAVE_TIME diff --git a/port/msp-exp430f5438-cc2564b/btstack_config.h b/port/msp-exp430f5438-cc2564b/btstack_config.h index efbfa6f0d..0e402e91d 100644 --- a/port/msp-exp430f5438-cc2564b/btstack_config.h +++ b/port/msp-exp430f5438-cc2564b/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_EHCILL #define HAVE_INIT_SCRIPT #define HAVE_TICK diff --git a/port/msp430f5229lp-cc2564b/btstack_config.h b/port/msp430f5229lp-cc2564b/btstack_config.h index 8cffce3aa..a2ecccb78 100644 --- a/port/msp430f5229lp-cc2564b/btstack_config.h +++ b/port/msp430f5229lp-cc2564b/btstack_config.h @@ -7,7 +7,6 @@ // Port related features #define HAVE_INIT_SCRIPT -#define HAVE_BZERO #define HAVE_TICK // #define HAVE_EHCILL diff --git a/port/mtk/btstack_config.h b/port/mtk/btstack_config.h index bbb9a9422..3b58efb2f 100644 --- a/port/mtk/btstack_config.h +++ b/port/mtk/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_MALLOC #define HAVE_POSIX_FILE_IO // #define HAVE_SO_NOSIGPIPE diff --git a/port/nrf5x/btstack_config.h b/port/nrf5x/btstack_config.h index 6120ebdbb..2952159a7 100644 --- a/port/nrf5x/btstack_config.h +++ b/port/nrf5x/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_EHCILL #define HAVE_TIME_MS #define WICED_BT_UART_MANUAL_CTS_RTS diff --git a/port/pic32-harmony/src/btstack_config.h b/port/pic32-harmony/src/btstack_config.h index 0a24ab121..9ace37b29 100644 --- a/port/pic32-harmony/src/btstack_config.h +++ b/port/pic32-harmony/src/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_TICK // BTstack features that can be enabled diff --git a/port/posix-h4/btstack_config.h b/port/posix-h4/btstack_config.h index ebfdaaeeb..9161a577e 100644 --- a/port/posix-h4/btstack_config.h +++ b/port/posix-h4/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_MALLOC #define HAVE_POSIX_FILE_IO #define HAVE_SO_NOSIGPIPE diff --git a/port/stm32-f103rb-nucleo/btstack_config.h b/port/stm32-f103rb-nucleo/btstack_config.h index 586f66f6f..864375847 100644 --- a/port/stm32-f103rb-nucleo/btstack_config.h +++ b/port/stm32-f103rb-nucleo/btstack_config.h @@ -7,7 +7,6 @@ // Port related features #define HAVE_INIT_SCRIPT -#define HAVE_BZERO #define HAVE_TICK #define HAVE_EHCILL diff --git a/port/wiced/btstack_config.h b/port/wiced/btstack_config.h index 6120ebdbb..2952159a7 100644 --- a/port/wiced/btstack_config.h +++ b/port/wiced/btstack_config.h @@ -6,7 +6,6 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_BZERO #define HAVE_EHCILL #define HAVE_TIME_MS #define WICED_BT_UART_MANUAL_CTS_RTS diff --git a/test/btstack_config.h b/test/btstack_config.h index 54ebe7447..9d05d4ac3 100644 --- a/test/btstack_config.h +++ b/test/btstack_config.h @@ -7,7 +7,6 @@ // Port related features #define HAVE_INIT_SCRIPT -#define HAVE_BZERO #define HAVE_TIME #define HAVE_MALLOC diff --git a/test/btstack_link_key_db/btstack_config.h b/test/btstack_link_key_db/btstack_config.h index cdcebc9cf..1a3561c44 100644 --- a/test/btstack_link_key_db/btstack_config.h +++ b/test/btstack_link_key_db/btstack_config.h @@ -7,7 +7,6 @@ // Port related features #define HAVE_INIT_SCRIPT -#define HAVE_BZERO #define HAVE_TIME // BTstack features that can be enabled diff --git a/test/pts/bnep_test.c b/test/pts/bnep_test.c index 16307c711..fbf42d9e2 100644 --- a/test/pts/bnep_test.c +++ b/test/pts/bnep_test.c @@ -243,7 +243,7 @@ static void send_arp_probe_ipv4(void){ pos += 2; bd_addr_copy(&network_buffer[pos], local_addr); // Sender Hardware Address (SHA) pos += 6; - bzero(&network_buffer[pos], 4); // Sender Protocol Adress (SPA) + memset(&network_buffer[pos], 0, 4); // Sender Protocol Adress (SPA) pos += 4; bd_addr_copy(&network_buffer[pos], other_addr); // Target Hardware Address (THA) (ignored for requests) pos += 6; @@ -491,7 +491,7 @@ static void send_llmnr_request_ipv4(void){ pos += sizeof(udp_header); // llmnr packet - bzero(llmnr_packet, sizeof(llmnr_packet)); + memset(llmnr_packet, 0, sizeof(llmnr_packet)); big_endian_store_16(llmnr_packet, 0, 0x1234); // transaction id big_endian_store_16(llmnr_packet, 4, 1); // one query @@ -530,7 +530,7 @@ static void send_llmnr_request_ipv6(void){ int payload_length = sizeof(udp_header) + sizeof(llmnr_packet) + sizeof(dns_data); // llmnr header - bzero(llmnr_packet, sizeof(llmnr_packet)); + memset(llmnr_packet, 0, sizeof(llmnr_packet)); big_endian_store_16(llmnr_packet, 0, 0x1235); // transaction id big_endian_store_16(llmnr_packet, 4, 1); // one query @@ -538,7 +538,7 @@ static void send_llmnr_request_ipv6(void){ big_endian_store_16(ipv6_header, 4, payload_length); // udp header - bzero(udp_header, sizeof(udp_header)); + memset(udp_header, 0, sizeof(udp_header)); big_endian_store_16(udp_header, 0, 5355); // source port big_endian_store_16(udp_header, 2, 5355); // destination port big_endian_store_16(udp_header, 4, payload_length); diff --git a/test/security_manager/aestest.c b/test/security_manager/aestest.c index 28ba29416..6dcb934e5 100644 --- a/test/security_manager/aestest.c +++ b/test/security_manager/aestest.c @@ -22,8 +22,8 @@ static void hexdump2(void *data, int size){ int main(void){ uint8_t key[16]; uint8_t plaintext[16]; - bzero(key, 16); - bzero(plaintext, 16); + memset(key, 0, 16); + memset(plaintext, 0, 16); uint8_t cyphertext[16]; aes128_calc_cyphertext(key, plaintext, cyphertext); hexdump2(cyphertext, 16);