cvs: php4 /ext/standard info.c /main main.c php_ini.c php_main.h
| From: | Zeev Suraski | Date: | Sat, 11 May 2002 12:41:33 +0000 |
| Subject: | cvs: php4 /ext/standard info.c /main main.c php_ini.c php_main.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11829@lists.php.net to get a copy of this message | ||
zeev Sat May 11 08:41:33 2002 EDT
Modified files:
/php4/ext/standard info.c
/php4/main main.c php_ini.c php_main.h
Log:
Centralize html_puts() logic - php_html_puts() remains as an API wrapper
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.175 php4/ext/standard/info.c:1.176
--- php4/ext/standard/info.c:1.175 Thu May 9 07:56:52 2002
+++ php4/ext/standard/info.c Sat May 11 08:41:32 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.175 2002/05/09 11:56:52 derick Exp $ */
+/* $Id: info.c,v 1.176 2002/05/11 12:41:32 zeev Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -79,7 +79,7 @@
PUTS("[\"");
switch (zend_hash_get_current_key(Z_ARRVAL_PP(data), &string_key, &num_key, 0)) {
case HASH_KEY_IS_STRING:
- php_html_puts(string_key, strlen(string_key) TSRMLS_CC);
+ zend_html_puts(string_key, strlen(string_key));
break;
case HASH_KEY_IS_LONG:
php_printf("%ld", num_key);
@@ -94,10 +94,10 @@
tmp2 = **tmp;
zval_copy_ctor(&tmp2);
convert_to_string(&tmp2);
- php_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2) TSRMLS_CC);
+ zend_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2));
zval_dtor(&tmp2);
} else {
- php_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) TSRMLS_CC);
+ zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
}
PUTS(" </td></tr>\n");
zend_hash_move_forward(Z_ARRVAL_PP(data));
@@ -290,7 +290,7 @@
PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\"
alt=\"Zend logo\"></a>\n");
}
php_printf("This program makes use of the Zend Scripting Language Engine:<br
/>");
- php_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
+ zend_html_puts(zend_version, strlen(zend_version));
php_info_print_box_end();
efree(php_uname);
}
@@ -482,7 +482,7 @@
if (!row_element || !*row_element) {
php_printf(" ");
} else {
- php_html_puts(row_element, strlen(row_element) TSRMLS_CC);
+ zend_html_puts(row_element, strlen(row_element));
}
php_printf("%s</td>", (i==0?"</b>":""));
Index: php4/main/main.c
diff -u php4/main/main.c:1.451 php4/main/main.c:1.452
--- php4/main/main.c:1.451 Sat May 11 08:17:53 2002
+++ php4/main/main.c Sat May 11 08:41:32 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.451 2002/05/11 12:17:53 zeev Exp $ */
+/* $Id: main.c,v 1.452 2002/05/11 12:41:32 zeev Exp $ */
/* {{{ includes
*/
@@ -377,54 +377,12 @@
}
/* }}} */
-/* {{{ php_html_puts */
-#include "ext/standard/php_smart_str.h"
+/* {{{ php_html_puts */
+/* wrapper for backwards compatibility */
PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC)
{
- const char *end = str+size;
- const char *p = str;
- smart_str s = {0};
-
- while (p < end) {
- switch (*p) {
- case '\n':
- smart_str_appendl(&s, "<br />", sizeof("<br />")-1);
- break;
- case '<':
- smart_str_appendl(&s, "<", sizeof("<")-1);
- break;
- case '>':
- smart_str_appendl(&s, ">", sizeof(">")-1);
- break;
- case '&':
- smart_str_appendl(&s, "&", sizeof("&")-1);
- break;
- case ' ': {
- const char *nextchar = p+1, *prevchar = p-1;
-
- /* series of spaces should be converted to 's */
- if (((nextchar < end) && *nextchar==' ')
- || ((prevchar >= str) && *prevchar==' ')) {
- smart_str_appendl(&s, " ", sizeof(" ")-1);
- } else {
- smart_str_appendc(&s, ' ');
- }
- }
- break;
- case '\t':
- smart_str_appendl(&s, " ",
sizeof(" ")-1);
- break;
- default:
- smart_str_appendc(&s, *p);
- }
- p++;
- }
-
- if (s.c) {
- PHPWRITE(s.c, s.len);
- smart_str_free(&s);
- }
+ zend_html_puts(str, size);
}
/* }}} */
Index: php4/main/php_ini.c
diff -u php4/main/php_ini.c:1.91 php4/main/php_ini.c:1.92
--- php4/main/php_ini.c:1.91 Fri May 10 23:41:16 2002
+++ php4/main/php_ini.c Sat May 11 08:41:33 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ini.c,v 1.91 2002/05/11 03:41:16 zeev Exp $ */
+/* $Id: php_ini.c,v 1.92 2002/05/11 12:41:33 zeev Exp $ */
/* Check CWD for php.ini */
#define INI_CHECK_CWD
@@ -74,7 +74,7 @@
display_string_length = sizeof("<i>no value</i>")-1;
}
if(esc_html) {
- php_html_puts(display_string, display_string_length TSRMLS_CC);
+ zend_html_puts(display_string, display_string_length);
} else {
PHPWRITE(display_string, display_string_length);
}
Index: php4/main/php_main.h
diff -u php4/main/php_main.h:1.19 php4/main/php_main.h:1.20
--- php4/main/php_main.h:1.19 Mon Mar 4 13:46:55 2002
+++ php4/main/php_main.h Sat May 11 08:41:33 2002
@@ -18,7 +18,7 @@
*/
-/* $Id: php_main.h,v 1.19 2002/03/04 18:46:55 sas Exp $ */
+/* $Id: php_main.h,v 1.20 2002/05/11 12:41:33 zeev Exp $ */
#ifndef PHP_MAIN_H
@@ -44,8 +44,6 @@
PHPAPI void php_handle_aborted_connection(void);
PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC);
-
-PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC);
extern void php_call_shutdown_functions(void);