Make ROOT's string functions private to ROOT - #23150
Conversation
9cebecd to
2385a9c
Compare
Test Results 21 files 21 suites 3d 8h 55m 22s ⏱️ For more details on these failures, see this check. Results for commit 17ac674. ♻️ This comment has been updated with latest results. |
| std::memcpy(_label, other._label, sizeof(_label)); | ||
| _label[255] = 0; |
There was a problem hiding this comment.
Not quite the same operation as before, right?
There was a problem hiding this comment.
Indeed, but it "correctly" copies the array (i.e. uses its actual size instead of a hardcoded one), and ensures that the string is always terminated.
The motivation is to remove any uses of ROOT's string functions from ROOT headers, so a replacement was needed.
There was a problem hiding this comment.
But indeed, I maybe shouldn't hardcode 255 if I remove the hardcoded number in the line above. 🙂
e5fcbae to
da5daa4
Compare
da5daa4 to
7087dc0
Compare
- Add a missing include - Remove usage of strlcpy from all RooFit headers
snprintf is standardised, so there is no more need to bring a custom implementation.
0236682 to
b16128d
Compare
Move string functions that originated in libbsd into a private library that's only compiled into ROOT's *.cxx files. Before, they were in Core, and the corresponding headers were visible outside of ROOT. Remove the headers from install set and modulemap.
b16128d to
17ac674
Compare
With a vision to possibly remove ROOT's C-string functions, make them private to ROOT.
This library consists of three (for now) public headers:
snprintf.h: Should be replaced with the C99 version.strlcpy.h: Like in libbsd. Try using it only in ROOT's .cxx files, so no public usage is visible from outside. Later, replace with standard functions.strtok.h: DefinesR__STRTOK_R. Only used in .cxx, so easy to hide. Could consider replacing it with standard functions later.Here, the first steps are taken to making the library private, so that it can either be replaced or removed without problems:
snprintfwith the C99 version.target_link_libraries(... PRIVATE), and with symbol visibility=hidden