From fdf8d493ff447ec9d3c84562949abbb0378ceed9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 9 Sep 2012 16:19:49 +0800 Subject: [PATCH] Revert "no use_namespace option anymore" This reverts commit 5cc2a9003f5f4346b9732010d4c96d8668c83dae. --- yaf.c | 59 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/yaf.c b/yaf.c index 33995f11..d2a9b86a 100644 --- a/yaf.c +++ b/yaf.c @@ -112,33 +112,40 @@ PHP_MINIT_FUNCTION(yaf) #endif #ifdef YAF_HAVE_NAMESPACE - REGISTER_STRINGL_CONSTANT("YAF\\VERSION", YAF_VERSION, sizeof(YAF_VERSION) - 1, CONST_PERSISTENT | CONST_CS); - REGISTER_STRINGL_CONSTANT("YAF\\ENVIRON", YAF_G(environ), strlen(YAF_G(environ)), CONST_PERSISTENT | CONST_CS); - - REGISTER_LONG_CONSTANT("YAF\\ERR\\STARTUP_FAILED", YAF_ERR_STARTUP_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\ROUTE_FAILED", YAF_ERR_ROUTE_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\DISPATCH_FAILED", YAF_ERR_DISPATCH_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\AUTOLOAD_FAILED", YAF_ERR_AUTOLOAD_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\MODULE", YAF_ERR_NOTFOUND_MODULE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\CONTROLLER",YAF_ERR_NOTFOUND_CONTROLLER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\ACTION", YAF_ERR_NOTFOUND_ACTION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\VIEW", YAF_ERR_NOTFOUND_VIEW, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\CALL_FAILED", YAF_ERR_CALL_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF\\ERR\\TYPE_ERROR", YAF_ERR_TYPE_ERROR, CONST_PERSISTENT | CONST_CS); + if(YAF_G(use_namespace)) { + + REGISTER_STRINGL_CONSTANT("YAF\\VERSION", YAF_VERSION, sizeof(YAF_VERSION) - 1, CONST_PERSISTENT | CONST_CS); + REGISTER_STRINGL_CONSTANT("YAF\\ENVIRON", YAF_G(environ), strlen(YAF_G(environ)), CONST_PERSISTENT | CONST_CS); + + REGISTER_LONG_CONSTANT("YAF\\ERR\\STARTUP_FAILED", YAF_ERR_STARTUP_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\ROUTE_FAILED", YAF_ERR_ROUTE_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\DISPATCH_FAILED", YAF_ERR_DISPATCH_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\AUTOLOAD_FAILED", YAF_ERR_AUTOLOAD_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\MODULE", YAF_ERR_NOTFOUND_MODULE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\CONTROLLER",YAF_ERR_NOTFOUND_CONTROLLER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\ACTION", YAF_ERR_NOTFOUND_ACTION, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\NOTFOUND\\VIEW", YAF_ERR_NOTFOUND_VIEW, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\CALL_FAILED", YAF_ERR_CALL_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF\\ERR\\TYPE_ERROR", YAF_ERR_TYPE_ERROR, CONST_PERSISTENT | CONST_CS); + + } else { +#endif + REGISTER_STRINGL_CONSTANT("YAF_VERSION", YAF_VERSION, sizeof(YAF_VERSION) - 1, CONST_PERSISTENT | CONST_CS); + REGISTER_STRINGL_CONSTANT("YAF_ENVIRON", YAF_G(environ),strlen(YAF_G(environ)), CONST_PERSISTENT | CONST_CS); + + REGISTER_LONG_CONSTANT("YAF_ERR_STARTUP_FAILED", YAF_ERR_STARTUP_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_ROUTE_FAILED", YAF_ERR_ROUTE_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_DISPATCH_FAILED", YAF_ERR_DISPATCH_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_AUTOLOAD_FAILED", YAF_ERR_AUTOLOAD_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_MODULE", YAF_ERR_NOTFOUND_MODULE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_CONTROLLER", YAF_ERR_NOTFOUND_CONTROLLER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_ACTION", YAF_ERR_NOTFOUND_ACTION, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_VIEW", YAF_ERR_NOTFOUND_VIEW, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_CALL_FAILED", YAF_ERR_CALL_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("YAF_ERR_TYPE_ERROR", YAF_ERR_TYPE_ERROR, CONST_PERSISTENT | CONST_CS); +#ifdef YAF_HAVE_NAMESPACE + } #endif - REGISTER_STRINGL_CONSTANT("YAF_VERSION", YAF_VERSION, sizeof(YAF_VERSION) - 1, CONST_PERSISTENT | CONST_CS); - REGISTER_STRINGL_CONSTANT("YAF_ENVIRON", YAF_G(environ),strlen(YAF_G(environ)), CONST_PERSISTENT | CONST_CS); - - REGISTER_LONG_CONSTANT("YAF_ERR_STARTUP_FAILED", YAF_ERR_STARTUP_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_ROUTE_FAILED", YAF_ERR_ROUTE_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_DISPATCH_FAILED", YAF_ERR_DISPATCH_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_AUTOLOAD_FAILED", YAF_ERR_AUTOLOAD_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_MODULE", YAF_ERR_NOTFOUND_MODULE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_CONTROLLER", YAF_ERR_NOTFOUND_CONTROLLER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_ACTION", YAF_ERR_NOTFOUND_ACTION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_NOTFOUND_VIEW", YAF_ERR_NOTFOUND_VIEW, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_CALL_FAILED", YAF_ERR_CALL_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("YAF_ERR_TYPE_ERROR", YAF_ERR_TYPE_ERROR, CONST_PERSISTENT | CONST_CS); /* startup components */ YAF_STARTUP(application);