[review] Use strtok_r instead of strtok

Pedro Alves (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Wed Nov 6 00:46:00 GMT 2019


Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/484
......................................................................


Patch Set 1: Code-Review+2

(1 comment)

I double-checked that we're pulling the strtok_r module in gnulib, so portability isn't an issue.

This LGTM.  Thanks for doing this.

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/484/1//COMMIT_MSG 
Commit Message:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/484/1//COMMIT_MSG@11 
PS1, Line 11: 
 6 | 
 7 | Use strtok_r instead of strtok
 8 | 
 9 | Improves threadsafety. Guile and Python can create threads, and the patch
10 | series at https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/176
11 > will make GDB create threads too.
12 | 
13 | gdb/ChangeLog:
14 | 
15 | 2019-11-02  Christian Biesinger  <cbiesinger@google.com>
16 | 

One would hope that using strtok in our code has no effect to Guile and Python, unless they're using strtok themselves, which I really hope they're not, since that would be obviously broken. E.g., if multiple python threads end up in strtok.  I'd bet they don't do that.

This is mainly useful to protect against multiple _gdb_ threads using strtok.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ief6138965a24398e5fc064598cd8f2abd3b5047c
Gerrit-Change-Number: 484
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Wed, 06 Nov 2019 00:46:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list