Skip to content

Commit 6f043fc

Browse files
committed
Fix deprecation of bzero, prefer POSIX over GNU extensions.
1 parent 15da163 commit 6f043fc

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

cores/esp8266/LwipDhcpServer.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ uint8_t* DhcpServer::add_offer_options(uint8_t *optptr)
383383
#define ipadd (_netif->ip_addr)
384384

385385
//struct ip_info if_ip;
386-
//bzero(&if_ip, sizeof(struct ip_info));
386+
//memset(&if_ip, 0, sizeof(struct ip_info));
387387
//wifi_get_ip_info(SOFTAP_IF, &if_ip);
388388
#define if_ip (*_netif)
389389

@@ -1008,7 +1008,7 @@ void DhcpServer::init_dhcps_lease(uint32 ip)
10081008
local_ip ++;
10091009
}
10101010

1011-
bzero(&dhcps_lease, sizeof(dhcps_lease));
1011+
memset(&dhcps_lease, 0, sizeof(dhcps_lease));
10121012
dhcps_lease.start_ip.addr = softap_ip | local_ip;
10131013
dhcps_lease.end_ip.addr = softap_ip | (local_ip + DHCPS_MAX_LEASE - 1);
10141014
dhcps_lease.start_ip.addr = htonl(dhcps_lease.start_ip.addr);
@@ -1162,7 +1162,7 @@ bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please)
11621162
return false;
11631163
}
11641164

1165-
bzero(&dhcps_lease, sizeof(dhcps_lease));
1165+
memset(&dhcps_lease, 0, sizeof(dhcps_lease));
11661166
// dhcps_lease.start_ip.addr = start_ip;
11671167
// dhcps_lease.end_ip.addr = end_ip;
11681168
dhcps_lease.start_ip.addr = please->start_ip.addr;
@@ -1206,15 +1206,15 @@ bool DhcpServer::get_dhcps_lease(struct dhcps_lease *please)
12061206
}
12071207
else
12081208
{
1209-
// bzero(please, sizeof(dhcps_lease));
1209+
// memset(please, 0, sizeof(dhcps_lease));
12101210
// if (!isRunning()){
12111211
// please->start_ip.addr = htonl(dhcps_lease.start_ip.addr);
12121212
// please->end_ip.addr = htonl(dhcps_lease.end_ip.addr);
12131213
// }
12141214
}
12151215

12161216
// if (isRunning()){
1217-
// bzero(please, sizeof(dhcps_lease));
1217+
// memset(please, 0, sizeof(dhcps_lease));
12181218
// please->start_ip.addr = dhcps_lease.start_ip.addr;
12191219
// please->end_ip.addr = dhcps_lease.end_ip.addr;
12201220
// }

platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
5656
compiler.sdk.path={runtime.platform.path}/tools/sdk
5757

5858
compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
59-
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
59+
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
6060

6161
compiler.c.cmd=xtensa-lx106-elf-gcc
6262
compiler.c.flags=-c {compiler.warning_flags} -std=gnu17 {build.stacksmash_flags} -Os -g -free -fipa-pta -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags}

tools/platformio-build.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def scons_patched_match_splitext(path, suffixes=None):
7373
"-mtext-section-literals",
7474
"-falign-functions=4",
7575
"-U__STRICT_ANSI__",
76+
"-D_XOPEN_SOURCE=700",
77+
"-D_DEFAULT_SOURCE",
7678
"-ffunction-sections",
7779
"-fdata-sections",
7880
"-Wall",

0 commit comments

Comments
 (0)