cvs: /php4/sapi/roxen roxen.c
| From: | David Hedbor | Date: | Wed, 01 Mar 2000 20:43:43 +0000 |
| Subject: | cvs: /php4/sapi/roxen roxen.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11289@lists.php.net to get a copy of this message | ||
neotron Wed Mar 1 12:43:43 2000 EDT
Modified files:
/php4/sapi/roxen roxen.c
Log:
Removal of printf-debug, changed sp/fp to Pike_sp / Pike_fp instead of
using a define.
Index: php4/sapi/roxen/roxen.c
diff -u php4/sapi/roxen/roxen.c:1.23 php4/sapi/roxen/roxen.c:1.24
--- php4/sapi/roxen/roxen.c:1.23 Mon Feb 28 17:12:28 2000
+++ php4/sapi/roxen/roxen.c Wed Mar 1 12:43:12 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: roxen.c,v 1.23 2000/02/29 01:12:28 neotron Exp $ */
+/* $Id: roxen.c,v 1.24 2000/03/01 20:43:12 neotron Exp $ */
#include "php.h"
#ifdef HAVE_ROXEN
@@ -58,16 +58,15 @@
#include <builtin_functions.h>
#include <operators.h>
+#undef HIDE_GLOBAL_VARIABLES
+#undef REVEAL_GLOBAL_VARIABLES
+#define HIDE_GLOBAL_VARIABLES()
+#define REVEAL_GLOBAL_VARIABLES()
-/* sp and fp was changed to Pike_?p to avoid conflicts with embedded perl */
-#ifndef sp
-#define sp Pike_sp
-#define fp Pike_fp
-#endif
-
/* php_roxen_request is per-request object storage */
-typedef struct {
+typedef struct
+{
struct mapping *request_data;
struct object *my_fd_obj;
int my_fd;
@@ -91,7 +90,7 @@
#else
static php_roxen_request *current_request = NULL;
-# define GET_THIS() current_request = ((php_roxen_request *)fp->current_storage)
+# define GET_THIS() current_request = ((php_roxen_request *)Pike_fp->current_storage)
# define THIS current_request
#endif
@@ -117,13 +116,13 @@
*/
static PIKE_MUTEX_T roxen_php_execution_lock;
# define PHP_INIT_LOCK() mt_init(&roxen_php_execution_lock)
-# define PHP_LOCK(X) fprintf(stderr, "*** php lock (thr_id=%d, glob=%d).\n", th_self(),
current_thread);THREADS_ALLOW();mt_lock(&roxen_php_execution_lock);fprintf(stderr, "*** php
locked.\n");THREADS_DISALLOW()
-# define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock);fprintf(stderr, "*** php
unlocked (thr_id=%d, glob=%d).\n", th_self(), current_thread);
+# define PHP_LOCK(X) THREADS_ALLOW();mt_lock(&roxen_php_execution_lock);THREADS_DISALLOW()
+# define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock);
# define PHP_DESTROY() mt_destroy(&roxen_php_execution_lock)
#else /* !_REENTRANT */
# define PHP_INIT_LOCK()
-# define PHP_LOCK(X) fprintf(stderr, "*** php lock (thr_id=%d).\n", th_self());
-# define PHP_UNLOCK(X) fprintf(stderr, "*** php unlock (thr_id=%d).\n", th_self());
+# define PHP_LOCK(X)
+# define PHP_UNLOCK(X)
# define PHP_DESTROY()
#endif /* _REENTRANT */
@@ -135,33 +134,19 @@
*/
#define THREAD_SAFE_RUN(COMMAND, what) do {\
struct thread_state *state;\
- fprintf(stderr,"threads: %d disabled: %d id: %d\n",num_threads, threads_disabled,
th_self());\
if((state = thread_state_for_id(th_self()))!=NULL) {\
if(!state->swapped) {\
- fprintf(stderr, "MT lock (%s).\n", what);\
COMMAND;\
- fprintf(stderr, "MT locked done (%s).\n", what);\
} else {\
- fprintf(stderr, "MT nonlock (%s).\n", what); \
mt_lock(&interpreter_lock);\
SWAP_IN_THREAD(state);\
- fprintf(stderr, "MT locked.\n", what); \
COMMAND;\
- fprintf(stderr, "MT locked done.\n", what); \
SWAP_OUT_THREAD(state);\
mt_unlock(&interpreter_lock);\
- fprintf(stderr, "MT unlocked.\n", what); \
}\
}\
} while(0)
-/* Toggle debug printouts, for now... */
-/*#define MUCH_DEBUG */
-#ifndef MUCH_DEBUG
-void no_fprintf(){}
-#define fprintf no_fprintf
-#endif
-
struct program *php_program;
@@ -201,13 +186,8 @@
{
struct svalue *head = NULL;
THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING) {
- fprintf(stderr, "Header lookup for %s: default (%s)\n", headername,
- default_value);
+ if(!head || head->type != PIKE_T_STRING)
return default_value;
- }
- fprintf(stderr, "Header lookup for %s: %s(%d)\n", headername,
- head->u.string->str, head->u.string->len);
return head->u.string->str;
}
@@ -218,13 +198,8 @@
{
struct svalue *head = NULL;
THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT) {
- fprintf(stderr, "Header lookup for %s: default (%d)\n", headername,
- default_value);
+ if(!head || head->type != PIKE_T_INT)
return default_value;
- }
- fprintf(stderr, "Header lookup for %s: %d \n", headername,
- head->u.integer);
return head->u.integer;
}
@@ -252,15 +227,14 @@
to_write = make_shared_binary_string(str, str_length);
push_string(to_write);
safe_apply(MY_FD_OBJ, "write", 1);
- if(sp[-1].type == PIKE_T_INT)
- sent_bytes = sp[-1].u.integer;
+ if(Pike_sp[-1].type == PIKE_T_INT)
+ sent_bytes = Pike_sp[-1].u.integer;
pop_stack();
if(sent_bytes != str_length) {
/* This means the connection is closed. Dead. Gone. *sniff* */
PG(connection_status) = PHP_CONNECTION_ABORTED;
zend_bailout();
}
- /* fprintf(stderr, "low_write done.\n");*/
return sent_bytes;
}
@@ -307,7 +281,6 @@
THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length),
"write");
}
- /* fprintf(stderr, "write done.\n"); */
return sent_bytes;
}
@@ -344,7 +317,6 @@
hsval.u.string = hval;
mapping_string_insert(headermap, hind, &hsval);
- fprintf(stderr, "Setting header %s to %s\n", hind->str, value);
free_string(hval);
free_string(ind);
free_string(hind);
@@ -395,7 +367,6 @@
ind = make_shared_string(" _headers");
s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
free_string(ind);
- fprintf(stderr, "Send Headers (%d)...\n", SG(sapi_headers).http_response_code);
push_int(SG(sapi_headers).http_response_code);
if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
@@ -430,10 +401,9 @@
#ifdef ZTS
PLS_FETCH();
#endif
-
- fprintf(stderr, "read post (%d bytes max)\n", count_bytes);
- if(!MY_FD_OBJ->prog) {
+ if(!MY_FD_OBJ->prog)
+ {
PG(connection_status) = PHP_CONNECTION_ABORTED;
zend_bailout();
return -1;
@@ -441,8 +411,9 @@
push_int(count_bytes);
safe_apply(MY_FD_OBJ, "read_post", 1);
- if(sp[-1].type == PIKE_T_STRING) {
- MEMCPY(buf, sp[-1].u.string->str, total_read = sp[-1].u.string->len);
+ if(Pike_sp[-1].type == PIKE_T_STRING) {
+ MEMCPY(buf, Pike_sp[-1].u.string->str,
+ (total_read = Pike_sp[-1].u.string->len));
buf[total_read] = '\0';
} else
total_read = -1;
@@ -474,9 +445,10 @@
static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS)
{
/* char buf[512]; */
+ extern void php_info_print_table_row( int, ... );
PUTS("<table border=5 width=600>\n");
- php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.23 2000/02/29
01:12:28 neotron Exp $");
+ php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.24 2000/03/01
20:43:12 neotron Exp $");
/* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
@@ -597,7 +569,6 @@
pval->type = IS_STRING;
pval->value.str.len = val->u.string->len;
pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len);
- fprintf(stderr, "Header: %s(%d)=%s\n", buf, buf_len, val->u.string->str);
zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
}
@@ -610,8 +581,6 @@
pval->type = IS_LONG;
pval->value.lval = Ns_InfoBootTime();
zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME",
sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
-
- fprintf(stderr, "Set up header environment.\n");
*/
}
@@ -636,7 +605,6 @@
file_handle.filename = THIS->filename;
file_handle.free_filename = 0;
THREADS_ALLOW();
- fprintf(stderr, "Request Startup.\n");
res = php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
THREADS_DISALLOW();
if(res == FAILURE) {
@@ -644,7 +612,6 @@
}
php_roxen_hash_environment(CLS_C ELS_CC PLS_CC SLS_CC);
THREADS_ALLOW();
- fprintf(stderr, "Script Execute.\n");
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
php_request_shutdown(NULL);
THREADS_DISALLOW();
@@ -723,7 +690,7 @@
/* Clear the object global struct */
static void clear_struct(struct object *o)
{
- MEMSET(fp->current_storage, 0, sizeof(php_roxen_request));
+ MEMSET(Pike_fp->current_storage, 0, sizeof(php_roxen_request));
}