Browse Source

Time to do that - rename the output layer prefix

experimetnal/RETURN_REF_PATCH
Zeev Suraski 27 years ago
parent
commit
a1784083e9
  1. 2
      cgi_main.c
  2. 8
      ext/standard/basic_functions.c
  3. 16
      main/main.c
  4. 12
      main/php.h
  5. 78
      output.c
  6. 12
      output.h

2
cgi_main.c

@ -372,7 +372,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
break;
case 'h':
case '?':
zend_output_startup();
php_output_startup();
SG(headers_sent) = 1;
php_cgi_usage(argv[0]);
exit(1);

8
ext/standard/basic_functions.c

@ -2175,25 +2175,25 @@ void test_class_startup()
PHP_FUNCTION(ob_start)
{
zend_start_ob_buffering();
php_start_ob_buffering();
}
PHP_FUNCTION(ob_end_flush)
{
zend_end_ob_buffering(1);
php_end_ob_buffering(1);
}
PHP_FUNCTION(ob_end_clean)
{
zend_end_ob_buffering(0);
php_end_ob_buffering(0);
}
PHP_FUNCTION(ob_get_contents)
{
if (zend_ob_get_buffer(return_value)==FAILURE) {
if (php_ob_get_buffer(return_value)==FAILURE) {
RETURN_FALSE;
}
}

16
main/main.c

@ -654,10 +654,10 @@ static void php_message_handler_for_zend(long message, void *data)
int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
{
zend_output_startup();
php_output_startup();
if (PG(output_buffering)) {
zend_start_ob_buffering();
php_start_ob_buffering();
}
#if APACHE
/*
@ -732,7 +732,7 @@ void php_request_shutdown(void *dummy)
SLS_FETCH();
sapi_send_headers();
zend_end_ob_buffering(SG(request_info).headers_only?0:1);
php_end_ob_buffering(SG(request_info).headers_only?0:1);
php3_call_shutdown_functions();
@ -771,9 +771,9 @@ static void php3_config_ini_shutdown()
}
static int zend_body_write_wrapper(const char *str, uint str_length)
static int php_body_write_wrapper(const char *str, uint str_length)
{
return zend_body_write(str, str_length);
return php_body_write(str, str_length);
}
#ifdef ZTS
@ -825,11 +825,11 @@ int php_module_startup(sapi_module_struct *sf)
sapi_module = *sf;
zend_output_startup();
php_output_startup();
zuf.error_function = php_error;
zuf.printf_function = php_printf;
zuf.write_function = zend_body_write_wrapper;
zuf.write_function = php_body_write_wrapper;
zuf.fopen_function = php_fopen_wrapper_for_zend;
zuf.message_handler = php_message_handler_for_zend;
zuf.block_interruptions = BLOCK_INTERRUPTIONS;
@ -1210,7 +1210,7 @@ PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mod
}
php3_header(); /* Make sure headers have been sent */
zend_end_ob_buffering(1);
php_end_ob_buffering(1);
return (OK);
}
#endif /* APACHE */

12
main/php.h

@ -312,12 +312,12 @@ PHPAPI int cfg_get_string(char *varname, char **result);
/* Output support */
#include "output.h"
#define PHPWRITE(str, str_len) zend_body_write((str), (str_len))
#define PUTS(str) zend_body_write((str), strlen((str)))
#define PUTC(c) (zend_body_write(&(c), 1), (c))
#define PHPWRITE_H(str, str_len) zend_header_write((str), (str_len))
#define PUTS_H(str) zend_header_write((str), strlen((str)))
#define PUTC_H(c) (zend_header_write(&(c), 1), (c))
#define PHPWRITE(str, str_len) php_body_write((str), (str_len))
#define PUTS(str) php_body_write((str), strlen((str)))
#define PUTC(c) (php_body_write(&(c), 1), (c))
#define PHPWRITE_H(str, str_len) php_header_write((str), (str_len))
#define PUTS_H(str) php_header_write((str), strlen((str)))
#define PUTC_H(c) (php_header_write(&(c), 1), (c))
#include "zend_operators.h"

78
output.c

@ -24,22 +24,22 @@
#include "SAPI.h"
/* output functions */
PHPAPI int (*zend_body_write)(const char *str, uint str_length); /* string output */
PHPAPI int (*zend_header_write)(const char *str, uint str_length); /* unbuffer string output */
static int zend_ub_body_write(const char *str, uint str_length);
static int zend_ub_body_write_no_header(const char *str, uint str_length);
static int zend_b_body_write(const char *str, uint str_length);
PHPAPI int (*php_body_write)(const char *str, uint str_length); /* string output */
PHPAPI int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
static int php_ub_body_write(const char *str, uint str_length);
static int php_ub_body_write_no_header(const char *str, uint str_length);
static int php_b_body_write(const char *str, uint str_length);
/* output buffering */
static char *ob_buffer;
static uint ob_buffer_size;
static uint ob_block_size;
static uint ob_text_length;
static void zend_ob_init(uint initial_size, uint block_size);
static void zend_ob_destroy();
static void zend_ob_append(const char *text, uint text_length);
static void zend_ob_prepend(const char *text, uint text_length);
static inline void zend_ob_send();
static void php_ob_init(uint initial_size, uint block_size);
static void php_ob_destroy();
static void php_ob_append(const char *text, uint text_length);
static void php_ob_prepend(const char *text, uint text_length);
static inline void php_ob_send();
/*
@ -47,24 +47,24 @@ static inline void zend_ob_send();
*/
/* Start output layer */
PHPAPI void zend_output_startup()
PHPAPI void php_output_startup()
{
ob_buffer = NULL;
zend_body_write = zend_ub_body_write;
zend_header_write = sapi_module.ub_write;
php_body_write = php_ub_body_write;
php_header_write = sapi_module.ub_write;
}
/* Start output buffering */
void zend_start_ob_buffering()
void php_start_ob_buffering()
{
zend_ob_init(4096, 1024);
zend_body_write = zend_b_body_write;
php_ob_init(4096, 1024);
php_body_write = php_b_body_write;
}
/* End output buffering */
void zend_end_ob_buffering(int send_buffer)
void php_end_ob_buffering(int send_buffer)
{
SLS_FETCH();
@ -72,14 +72,14 @@ void zend_end_ob_buffering(int send_buffer)
return;
}
if (SG(headers_sent) && !SG(request_info).headers_only) {
zend_body_write = zend_ub_body_write_no_header;
php_body_write = php_ub_body_write_no_header;
} else {
zend_body_write = zend_ub_body_write;
php_body_write = php_ub_body_write;
}
if (send_buffer) {
zend_ob_send();
php_ob_send();
}
zend_ob_destroy();
php_ob_destroy();
}
@ -87,7 +87,7 @@ void zend_end_ob_buffering(int send_buffer)
* Output buffering - implementation
*/
static inline void zend_ob_allocate()
static inline void php_ob_allocate()
{
if (ob_buffer_size<ob_text_length) {
while ((ob_buffer_size+=ob_block_size) < ob_text_length);
@ -96,7 +96,7 @@ static inline void zend_ob_allocate()
}
static void zend_ob_init(uint initial_size, uint block_size)
static void php_ob_init(uint initial_size, uint block_size)
{
if (ob_buffer) {
return;
@ -108,7 +108,7 @@ static void zend_ob_init(uint initial_size, uint block_size)
}
static void zend_ob_destroy()
static void php_ob_destroy()
{
if (ob_buffer) {
efree(ob_buffer);
@ -117,27 +117,27 @@ static void zend_ob_destroy()
}
static void zend_ob_append(const char *text, uint text_length)
static void php_ob_append(const char *text, uint text_length)
{
char *target;
int original_ob_text_length=ob_text_length;
ob_text_length += text_length;
zend_ob_allocate();
php_ob_allocate();
target = ob_buffer+original_ob_text_length;
memcpy(target, text, text_length);
target[text_length]=0;
}
static void zend_ob_prepend(const char *text, uint text_length)
static void php_ob_prepend(const char *text, uint text_length)
{
char *p, *start;
ob_text_length += text_length;
zend_ob_allocate();
php_ob_allocate();
/* zend_ob_allocate() may change ob_buffer, so we can't initialize p&start earlier */
/* php_ob_allocate() may change ob_buffer, so we can't initialize p&start earlier */
p = ob_buffer+ob_text_length;
start = ob_buffer;
@ -149,15 +149,15 @@ static void zend_ob_prepend(const char *text, uint text_length)
}
static inline void zend_ob_send()
static inline void php_ob_send()
{
/* header_write is a simple, unbuffered output function */
zend_body_write(ob_buffer, ob_text_length);
php_body_write(ob_buffer, ob_text_length);
}
/* Return the current output buffer */
int zend_ob_get_buffer(pval *p)
int php_ob_get_buffer(pval *p)
{
if (!ob_buffer) {
return FAILURE;
@ -175,20 +175,20 @@ int zend_ob_get_buffer(pval *p)
/* buffered output function */
static int zend_b_body_write(const char *str, uint str_length)
static int php_b_body_write(const char *str, uint str_length)
{
zend_ob_append(str, str_length);
php_ob_append(str, str_length);
return str_length;
}
static int zend_ub_body_write_no_header(const char *str, uint str_length)
static int php_ub_body_write_no_header(const char *str, uint str_length)
{
return zend_header_write(str, str_length);
return php_header_write(str, str_length);
}
static int zend_ub_body_write(const char *str, uint str_length)
static int php_ub_body_write(const char *str, uint str_length)
{
char *newstr = NULL;
uint new_length;
@ -206,8 +206,8 @@ static int zend_ub_body_write(const char *str, uint str_length)
str_length = new_length;
}
zend_body_write = zend_ub_body_write_no_header;
result = zend_ub_body_write_no_header(str, str_length);
php_body_write = php_ub_body_write_no_header;
result = php_ub_body_write_no_header(str, str_length);
if (newstr) {
free(newstr);

12
output.h

@ -22,14 +22,14 @@
#include "php.h"
PHPAPI void zend_output_startup();
PHPAPI void php_output_startup();
/* exported output functions */
PHPAPI int (*zend_body_write)(const char *str, uint str_length); /* string output */
PHPAPI int (*zend_header_write)(const char *str, uint str_length); /* unbuffer string output */
void zend_start_ob_buffering();
void zend_end_ob_buffering(int send_buffer);
int zend_ob_get_buffer(pval *p);
PHPAPI int (*php_body_write)(const char *str, uint str_length); /* string output */
PHPAPI int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
void php_start_ob_buffering();
void php_end_ob_buffering(int send_buffer);
int php_ob_get_buffer(pval *p);
/* HEAD support */
void set_header_request(int value);

Loading…
Cancel
Save