[Xapian-tickets] [Xapian] #665: Avoid C library functions not guaranteed to be thread-safe
Xapian
nobody at xapian.org
Tue Oct 29 08:43:29 GMT 2019
#665: Avoid C library functions not guaranteed to be thread-safe
-------------------------+--------------------------
Reporter: olly | Owner: olly
Type: defect | Status: new
Priority: normal | Milestone: 1.4.x
Component: Library API | Version: 1.3.2
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
-------------------------+--------------------------
Comment (by olly):
I've now eliminated all uses of `atoi()` and `strtol()` in the library
itself.
Current status:
* `getenv()` - used to read things like `XAPIAN_FLUSH_THRESHOLD`.
* `strerror()` (but only if there's no thread-safe alternative).
* `strtod()` - `weight/weightinternal.h` parsing double parameters,
`api/valuerangeproc.cc` `NumberRangeProcessor::operator()` - also means
that behaviour depends on the locale, which is probably not always
desirable. C++17 provides
[https://en.cppreference.com/w/cpp/utility/from_chars std::from_chars()]
which we could use if available. Do we want to provide a way to allow `,`
as decimal point though?
Also to do:
* Add section to the developer docs about this
* Add checks to `xapian-check-patch` to prevent more calls to problematic
functions from being introduced into the library code
--
Ticket URL: <https://trac.xapian.org/ticket/665#comment:17>
Xapian <https://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list