[Xapian-tickets] [Xapian] #665: Avoid C library functions not guaranteed to be thread-safe

Xapian nobody at xapian.org
Fri Oct 25 21:04:09 BST 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):

 Current status:

  * `getenv()` - used to read things like `XAPIAN_FLUSH_THRESHOLD`.
  * `strerror()` (but only if there's no thread-safe alternative).
  * `atoi()` - `api/valuerangeproc.cc` (`DateRangeProcessor`),
 `backends/databasehelpers.h` (parsing port number in remote stub lines),
  * `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.
  * `strtol()` - `weight/lmweight.cc`

 And as noted before, we should have a section in the developer docs about
 this too.  Also maybe poison some of these to stop them being reintroduced
 (at least `strtol()` seems to have appeared since I last checked).  Not
 sure how easy that is to do just for the library, and we don't need to
 worry about these in the tools, examples, or testsuite.

--
Ticket URL: <https://trac.xapian.org/ticket/665#comment:9>
Xapian <https://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list