Browse Source

properly export tsrm_strtok_r()

for this particular case fixing phar shared build, but for the
general usage anyway
pull/864/head
Anatol Belski 11 years ago
parent
commit
d58b70622a
  1. 2
      TSRM/tsrm_strtok_r.c
  2. 4
      TSRM/tsrm_strtok_r.h
  3. 48
      ext/phar/phar.c

2
TSRM/tsrm_strtok_r.c

@ -14,7 +14,7 @@ static inline int in_character_class(char ch, const char *delim)
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;

4
TSRM/tsrm_strtok_r.h

@ -1,6 +1,8 @@
#ifndef 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

48
ext/phar/phar.c

@ -2072,54 +2072,6 @@ static int php_check_dots(const char *element, int n) /* {{{ */
#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
*/

Loading…
Cancel
Save