mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Remove unused tsrm_strtok_r() function
There is also a php_strtok_r() function, which is actually used, but nothing uses the tsrm_strtok_r() variant...
This commit is contained in:
parent
94d37a5dd7
commit
709897c2a5
5 changed files with 2 additions and 78 deletions
|
@ -1,4 +1,4 @@
|
|||
// vim:ft=javascript
|
||||
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_win32.c");
|
||||
ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "tsrm_config_common.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
static inline int in_character_class(char ch, const char *delim)
|
||||
{/*{{{*/
|
||||
while (*delim) {
|
||||
if (*delim == ch) {
|
||||
return 1;
|
||||
}
|
||||
delim++;
|
||||
}
|
||||
return 0;
|
||||
}/*}}}*/
|
||||
|
||||
TSRM_API 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;
|
||||
}/*}}}*/
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
char foo[] = "/foo/bar//\\barbara";
|
||||
char *last;
|
||||
char *token;
|
||||
|
||||
token = tsrm_strtok_r(foo, "/\\", &last);
|
||||
while (token) {
|
||||
printf ("Token = '%s'\n", token);
|
||||
token = tsrm_strtok_r(NULL, "/\\", &last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
|
@ -1521,7 +1521,7 @@ PHP_SUBST(install_binary_targets)
|
|||
|
||||
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
|
||||
|
||||
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
PHP_ADD_SOURCES(TSRM, TSRM.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
|
||||
PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
|
||||
fopen_wrappers.c alloca.c php_scandir.c \
|
||||
|
|
|
@ -49,9 +49,6 @@
|
|||
#include "ext/standard/sha1.h"
|
||||
#include "ext/standard/php_var.h"
|
||||
#include "ext/standard/php_versioning.h"
|
||||
#ifndef PHP_WIN32
|
||||
#include "TSRM/tsrm_strtok_r.h"
|
||||
#endif
|
||||
#include "Zend/zend_virtual_cwd.h"
|
||||
#include "ext/spl/spl_array.h"
|
||||
#include "ext/spl/spl_directory.h"
|
||||
|
@ -477,8 +474,6 @@ extern zend_string *(*phar_save_resolve_path)(const char *filename, size_t filen
|
|||
BEGIN_EXTERN_C()
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
static inline void phar_unixify_path_separators(char *path, size_t path_len)
|
||||
{
|
||||
char *s;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue