mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
properly export tsrm_strtok_r()
for this particular case fixing phar shared build, but for the general usage anyway
This commit is contained in:
parent
7c7b9184b1
commit
d58b70622a
3 changed files with 4 additions and 50 deletions
|
@ -14,7 +14,7 @@ static inline int in_character_class(char ch, const char *delim)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef TSRM_STRTOK_R
|
#ifndef TSRM_STRTOK_R
|
||||||
#define TSRM_STRTOK_R
|
#define TSRM_STRTOK_R
|
||||||
|
|
||||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
#include "TSRM.h"
|
||||||
|
|
||||||
|
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2072,54 +2072,6 @@ static int php_check_dots(const char *element, int n) /* {{{ */
|
||||||
|
|
||||||
#define IS_BACKSLASH(c) ((c) == '/')
|
#define IS_BACKSLASH(c) ((c) == '/')
|
||||||
|
|
||||||
#ifdef COMPILE_DL_PHAR
|
|
||||||
/* stupid-ass non-extern declaration in tsrm_strtok.h breaks dumbass MS compiler */
|
|
||||||
static inline int in_character_class(char ch, const char *delim) /* {{{ */
|
|
||||||
{
|
|
||||||
while (*delim) {
|
|
||||||
if (*delim == ch) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
++delim;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
char *tsrm_strtok_r(char *s, const char *delim, char **last) /* {{{ */
|
|
||||||
{
|
|
||||||
char *token;
|
|
||||||
|
|
||||||
if (s == NULL) {
|
|
||||||
s = *last;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*s && in_character_class(*s, delim)) {
|
|
||||||
++s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*s) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
token = s;
|
|
||||||
|
|
||||||
while (*s && !in_character_class(*s, delim)) {
|
|
||||||
++s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*s) {
|
|
||||||
*last = s;
|
|
||||||
} else {
|
|
||||||
*s = '\0';
|
|
||||||
*last = s + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove .. and . references within a phar filename
|
* Remove .. and . references within a phar filename
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue