Skip to content

Fix deprecation of bzero, prefer POSIX over GNU newlib extensions #8150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cores/esp8266/LwipDhcpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ uint8_t* DhcpServer::add_offer_options(uint8_t *optptr)
#define ipadd (_netif->ip_addr)

//struct ip_info if_ip;
//bzero(&if_ip, sizeof(struct ip_info));
//memset(&if_ip, 0, sizeof(struct ip_info));
//wifi_get_ip_info(SOFTAP_IF, &if_ip);
#define if_ip (*_netif)

Expand Down Expand Up @@ -1008,7 +1008,7 @@ void DhcpServer::init_dhcps_lease(uint32 ip)
local_ip ++;
}

bzero(&dhcps_lease, sizeof(dhcps_lease));
memset(&dhcps_lease, 0, sizeof(dhcps_lease));
dhcps_lease.start_ip.addr = softap_ip | local_ip;
dhcps_lease.end_ip.addr = softap_ip | (local_ip + DHCPS_MAX_LEASE - 1);
dhcps_lease.start_ip.addr = htonl(dhcps_lease.start_ip.addr);
Expand Down Expand Up @@ -1162,7 +1162,7 @@ bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please)
return false;
}

bzero(&dhcps_lease, sizeof(dhcps_lease));
memset(&dhcps_lease, 0, sizeof(dhcps_lease));
// dhcps_lease.start_ip.addr = start_ip;
// dhcps_lease.end_ip.addr = end_ip;
dhcps_lease.start_ip.addr = please->start_ip.addr;
Expand Down Expand Up @@ -1206,15 +1206,15 @@ bool DhcpServer::get_dhcps_lease(struct dhcps_lease *please)
}
else
{
// bzero(please, sizeof(dhcps_lease));
// memset(please, 0, sizeof(dhcps_lease));
// if (!isRunning()){
// please->start_ip.addr = htonl(dhcps_lease.start_ip.addr);
// please->end_ip.addr = htonl(dhcps_lease.end_ip.addr);
// }
}

// if (isRunning()){
// bzero(please, sizeof(dhcps_lease));
// memset(please, 0, sizeof(dhcps_lease));
// please->start_ip.addr = dhcps_lease.start_ip.addr;
// please->end_ip.addr = dhcps_lease.end_ip.addr;
// }
Expand Down
2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk

compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
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"
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"

compiler.c.cmd=xtensa-lx106-elf-gcc
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}
Expand Down
2 changes: 2 additions & 0 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def scons_patched_match_splitext(path, suffixes=None):
"-mtext-section-literals",
"-falign-functions=4",
"-U__STRICT_ANSI__",
"-D_XOPEN_SOURCE=700",
"-D_DEFAULT_SOURCE",
"-ffunction-sections",
"-fdata-sections",
"-Wall",
Expand Down