summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2009-07-26 22:59:46 +0000
committerJani Taskinen <jani@php.net>2009-07-26 22:59:46 +0000
commitae492897c6603db9ba4efc3d7d5db005d9f34295 (patch)
treeae165fb68bf1d8c8507b3d71faa8c90bbdb94f46 /ext/standard
parentd132b9985d13fff994701137e5f7cf1e922649e3 (diff)
downloadphp-git-ae492897c6603db9ba4efc3d7d5db005d9f34295.tar.gz
- Removed unused code (replaced long time ago by url_scanner_ex.*
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/basic_functions.h3
-rw-r--r--ext/standard/config.m42
-rw-r--r--ext/standard/config.w322
-rw-r--r--ext/standard/url_scanner.c373
-rw-r--r--ext/standard/url_scanner.h54
6 files changed, 2 insertions, 434 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index b00a96399b..115d2adc9d 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1,4 +1,3 @@
-
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -3462,7 +3461,6 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) /*
zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1);
BG(sm_allowed_env_vars) = NULL;
- memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state)));
memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
#if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 7b09a7c881..b599442fcf 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -32,7 +32,6 @@
#include "zend_highlight.h"
-#include "url_scanner.h"
#include "url_scanner_ex.h"
extern zend_module_entry basic_functions_module;
@@ -207,8 +206,6 @@ typedef struct _php_basic_globals {
/* var.c */
zend_class_entry *incomplete_class;
- /* url_scanner.c */
- url_adapt_state_t url_adapt_state;
/* url_scanner_ex.re */
url_adapt_state_ex_t url_adapt_state_ex;
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 042e1ccd6b..0e0244c001 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -457,7 +457,7 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.
info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
microtime.c pack.c pageinfo.c quot_print.c rand.c \
soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \
- url_scanner.c var.c versioning.c assert.c strnatcmp.c levenshtein.c \
+ var.c versioning.c assert.c strnatcmp.c levenshtein.c \
incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index 869b6e4e9c..bca42211b6 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -15,7 +15,7 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
info.c iptc.c lcg.c link_win32.c mail.c math.c md5.c metaphone.c microtime.c \
pack.c pageinfo.c quot_print.c rand.c soundex.c \
- string.c scanf.c syslog.c type.c uniqid.c url.c url_scanner.c var.c \
+ string.c scanf.c syslog.c type.c uniqid.c url.c var.c \
versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c
deleted file mode 100644
index 095b4de8ee..0000000000
--- a/ext/standard/url_scanner.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include "php_globals.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "basic_functions.h"
-#include "url_scanner.h"
-
-#ifndef BUFSIZE
-#define BUFSIZE 256
-#endif
-
-int php_url_scanner_activate(TSRMLS_D)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-
-int php_url_scanner_deactivate(TSRMLS_D)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-/* {{{ url_attr_addon
- */
-static char *url_attr_addon(const char *tag,const char *attr,const char *val,const char *buf)
-{
- int flag = 0;
-
- if (!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
- flag = 1;
- } else if (!strcasecmp(tag,"area" ) && !strcasecmp(attr,"href" )) {
- flag = 1;
- } else if (!strcasecmp(tag,"form" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- } else if (!strcasecmp(tag,"frame") && !strcasecmp(attr,"source" )) {
- flag = 1;
- } else if (!strcasecmp(tag,"img" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- }
- if(flag && !strstr(val,buf) && !strchr(val,':')) {
- char *result;
- TSRMLS_FETCH();
-
- spprintf(&result, 0, "%s%s", (strchr(val,'?') ? PG(arg_separator).output : "?"), buf);
- return result;
- }
- return NULL;
-}
-/* }}} */
-
-#define US BG(url_adapt_state)
-
-/* {{{ url_adapt_ext
- */
-char *url_adapt_ext(const char *src, uint srclen, const char *name, const char *val, size_t *newlen)
-{
- char buf[1024];
-
- snprintf(buf, sizeof(buf)-1, "%s=%s", name, val);
-
- return url_adapt(src, srclen, buf, newlen);
-}
-/* }}} */
-
-/* {{{ url_adapt
- */
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen)
-{
- char *out,*outp;
- int maxl,n;
- TSRMLS_FETCH();
-
- if(src==NULL) {
- US.state=STATE_NORMAL;
- if(US.tag) { efree(US.tag); US.tag =NULL; }
- if(US.attr) { efree(US.attr); US.attr=NULL; }
- if(US.val) { efree(US.val); US.val =NULL; }
- return NULL;
- }
-
- if(srclen==0)
- srclen=strlen(src);
-
- out=malloc(srclen+1);
- maxl=srclen;
- n=srclen;
-
- *newlen=0;
- outp=out;
-
- while(n--) {
- switch(US.state) {
- case STATE_NORMAL:
- if(*src=='<')
- US.state=STATE_TAG_START;
- break;
-
- case STATE_TAG_START:
- if(! isalnum(*src))
- US.state=STATE_NORMAL;
- US.state=STATE_TAG;
- US.ml=BUFSIZE;
- US.p=US.tag=erealloc(US.tag,US.ml);
- *(US.p)++=*src;
- US.l=1;
- break;
-
- case STATE_TAG:
- if(isalnum(*src)) {
- *(US.p)++ = *src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.tag=erealloc(US.tag,US.ml);
- US.p = US.tag+US.l;
- }
- } else if (isspace(*src)) {
- US.state = STATE_IN_TAG;
- *US.p='\0';
- US.tag=erealloc(US.tag,US.l);
- } else {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_IN_TAG:
- if(isalnum(*src)) {
- US.state=STATE_TAG_ATTR;
- US.ml=BUFSIZE;
- US.p=US.attr=erealloc(US.attr,US.ml);
- *(US.p)++=*src;
- US.l=1;
- } else if (! isspace(*src)) {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_TAG_ATTR:
- if(isalnum(*src)) {
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- } else if(isspace(*src)||(*src=='=')){
- US.state=STATE_TAG_IS;
- *US.p=0;
- US.attr=erealloc(US.attr,US.l);
- } else if(*src=='>') {
- US.state=STATE_NORMAL;
- } else {
- efree(US.attr);
- US.attr=NULL;
- US.state=STATE_IN_TAG;
- }
- break;
-
- case STATE_TAG_IS:
- case STATE_TAG_IS2:
- if(*src=='>'){
- US.state=STATE_NORMAL;
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,"",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp,p,maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- p=url_attr_addon(US.tag,US.attr,"#",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp, p, maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(!isspace(*src)&&(*src!='=')) {
- US.ml=BUFSIZE;
- US.p=US.val=erealloc(US.val,US.ml);
- US.l=0;
- US.attr_done=0;
- if((*src=='"')||(*src=='\'')) {
- US.state=STATE_TAG_QVAL2;
- US.delim=*src;
- } else {
- US.state=STATE_TAG_VAL;
- *US.p++=*src;
- US.l++;
- }
- }
- break;
-
-
- case STATE_TAG_QVAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp,p,maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src==US.delim) {
- US.state=STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp,p,maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- break;
- } else if(*src=='\\') {
- US.state=STATE_TAG_QVAL2b;
- } else if (*src=='>') {
- US.state=STATE_NORMAL;
- }
-
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
-
- break;
-
- case STATE_TAG_QVAL2b:
- US.state=STATE_TAG_QVAL2;
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- break;
-
- case STATE_TAG_VAL:
- case STATE_TAG_VAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp,p,maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(isspace(*src)||(*src=='>')) {
- US.state=(*src=='>')?STATE_NORMAL:STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strlcpy(outp,p,maxl);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else {
- *US.p++=*src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- }
- break;
- default:
- break;
- }
-
- *outp++=*src++;
- *newlen+=1;
- }
- *outp='\0';
- return out;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/standard/url_scanner.h b/ext/standard/url_scanner.h
deleted file mode 100644
index 610056059b..0000000000
--- a/ext/standard/url_scanner.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef URI_SCANNER_H
-#define URI_SCANNER_H
-
-int php_url_scanner_activate(TSRMLS_D);
-int php_url_scanner_deactivate(TSRMLS_D);
-
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen);
-
-enum url_state {
- STATE_NORMAL,
- STATE_TAG_START,
- STATE_TAG,
- STATE_IN_TAG,
- STATE_TAG_ATTR,
- STATE_TAG_IS,
- STATE_TAG_IS2,
- STATE_TAG_VAL,
- STATE_TAG_VAL2,
- STATE_TAG_QVAL1,
- STATE_TAG_QVAL2,
- STATE_TAG_QVAL2b
-};
-
-typedef struct url_adapt_struct {
- enum url_state state;
- char *tag;
- char *attr;
- char *val;
- char delim;
- char *p;
- int l, ml;
- int attr_done;
-} url_adapt_state_t;
-
-#endif