0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 23:51:04 +08:00

Merge pull request #3788 from colletted/feature

Replace strtok with strtok_r
This commit is contained in:
Luca Boccassi 2020-01-23 09:34:12 +00:00 committed by GitHub
commit 72865e1b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

7
RELICENSE/colletted.md Normal file
View File

@ -0,0 +1,7 @@
Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL
This is a statement by Denis Collette that grants permission to relicense its copyrights in the libzmq C++ library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other Open Source Initiative approved license chosen by the current ZeroMQ BDFL (Benevolent Dictator for Life).
A portion of the commits made by the Github handle "colletted", with commit author "Denis Collette denisncollette@gmail.com", are copyright of Denis Collette. This document hereby grants the libzmq project team to relicense libzmq, including all past, present and future contributions of the author listed above.
Denis Collette 2020/01/22

View File

@ -73,6 +73,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define strtok_r strtok_s
#else #else
#ifdef ZMQ_HAVE_LIBBSD #ifdef ZMQ_HAVE_LIBBSD
#include <bsd/string.h> #include <bsd/string.h>
@ -487,7 +488,8 @@ bool zmq::ws_engine_t::server_handshake ()
// Sec-WebSocket-Protocol can appear multiple times or be a comma separated list // Sec-WebSocket-Protocol can appear multiple times or be a comma separated list
// if _websocket_protocol is already set we skip the check // if _websocket_protocol is already set we skip the check
if (_websocket_protocol[0] == '\0') { if (_websocket_protocol[0] == '\0') {
char *p = strtok (_header_value, ","); char *rest;
char *p = strtok_r (_header_value, ",", &rest);
while (p != NULL) { while (p != NULL) {
if (*p == ' ') if (*p == ' ')
p++; p++;
@ -497,7 +499,7 @@ bool zmq::ws_engine_t::server_handshake ()
break; break;
} }
p = strtok (NULL, ","); p = strtok_r (NULL, ",", &rest);
} }
} }
} }