mirror of
https://github.com/curl/curl.git
synced 2026-05-30 06:47:28 +03:00
build: avoid overriding system symbols for socket functions
Before this patch `accept4()`, `socket()`, `socketpair()`, `send()` and `recv()` system symbols were remapped via macros, using the same name, to local curl debug wrappers. This patch replaces these overrides by introducing curl-namespaced macros that map either to the system symbols or to their curl debug wrappers in `CURLDEBUG` (TrackMemory) builds. This follows a patch that implemented the same for `accept()`. The old method required tricks to make these redefines work in unity builds, and avoid them interfering with system headers. These tricks did not work for system symbols implemented as macros. The new method allows to setup these mappings once, without interfering with system headers, upstream macros, or unity builds. It makes builds more robust. Also: - checksrc: ban all mapped functions. - docs/examples: tidy up checksrc rules. Follow-up to9863599d69#18502 Follow-up to3bb5e58c10#17827 Closes #18503
This commit is contained in:
parent
2fe95cb0e3
commit
bf7375ecc5
24 changed files with 74 additions and 57 deletions
3
docs/examples/.checksrc
Normal file
3
docs/examples/.checksrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
allowfunc gmtime
|
||||
allowfunc localtime
|
||||
allowfunc socket
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt README.md Makefile.example $(COMPLICATED_EXAMPLES)
|
||||
EXTRA_DIST = CMakeLists.txt .checksrc README.md Makefile.example $(COMPLICATED_EXAMPLES)
|
||||
|
||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
||||
# $(top_builddir), to ensure that these paths which belong to the library
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ int my_trace(CURL *handle, curl_infotype type,
|
|||
known_offset = 1;
|
||||
}
|
||||
secs = epoch_offset + tv.tv_sec;
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
now = localtime(&secs); /* not thread safe but we do not care */
|
||||
curl_msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
|
||||
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
|
||||
|
|
|
|||
|
|
@ -298,10 +298,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Calculating time diff between GMT and localtime */
|
||||
tt = time(0);
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
lt = localtime(&tt);
|
||||
tt_local = mktime(lt);
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
gmt = gmtime(&tt);
|
||||
tt_gmt = mktime(gmt);
|
||||
tzonediffFloat = difftime(tt_local, tt_gmt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue