Skip to content

Commit

Permalink
properly export tsrm_strtok_r()
Browse files Browse the repository at this point in the history
for this particular case fixing phar shared build, but for the
general usage anyway
  • Loading branch information
weltling committed Oct 5, 2014
1 parent 7c7b918 commit d58b706
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 50 deletions.
2 changes: 1 addition & 1 deletion TSRM/tsrm_strtok_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion TSRM/tsrm_strtok_r.h
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 48 deletions ext/phar/phar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit d58b706

Please sign in to comment.