[PATCH 0/5] banned: mark `strok()`, `strtok_r()` as banned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series adds `strtok()`, and its reentrant variant to the list of
banned functions.

The rationale is described in the final patch, but the gist is that even
though `strtok_r()` is thread-safe, it imposes a burden on the caller
and has confusing dataflow. For more details, the final patch has a full
explanation.

The series is structured as follows:

  - The first patch introduces `string_list_split_in_place_multi()`,
    which allows us to split token delimited strings in place where
    the set of accepted tokens is more than a single character.

  - The next three patches replace the only in-tree uses of strtok() we
    have, which are all in test helpers.

  - The final patch marks the two functions as banned.

Thanks in advance for your review!

Taylor Blau (5):
  string-list: introduce `string_list_split_in_place_multi()`
  t/helper/test-hashmap.c: avoid using `strtok()`
  t/helper/test-oidmap.c: avoid using `strtok()`
  t/helper/test-json-writer.c: avoid using `strtok()`
  banned.h: mark `strtok()`, `strtok_r()` as banned

 banned.h                    |  6 +++
 string-list.c               | 15 ++++++--
 string-list.h               |  6 +++
 t/helper/test-hashmap.c     | 30 +++++++++++----
 t/helper/test-json-writer.c | 76 +++++++++++++++++++++++--------------
 t/helper/test-oidmap.c      | 20 +++++++---
 6 files changed, 109 insertions(+), 44 deletions(-)

-- 
2.38.0.16.g393fd4c6db



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux