The PHP NSAPI plugin for Sun Web Server could be made more efficient
by using the pool_* APIs that are exposed by Sun Web Server's NSAPI
interface.

The attached patch avoids invoking pthread_getspecific by using
pool_malloc/pool_free instead of MALLOC/FREE.

thx,
arvi
diff -r ababbd629dca sapi/nsapi/nsapi.c
--- a/sapi/nsapi/nsapi.c        Wed Oct 28 12:32:40 2009 +0530
+++ b/sapi/nsapi/nsapi.c        Wed Oct 28 12:34:38 2009 +0530
@@ -1003,7 +1003,11 @@
                }
        }
 
-       request_context = (nsapi_request_context 
*)MALLOC(sizeof(nsapi_request_context));
+       request_context = (nsapi_request_context *)pool_malloc(sn->pool, 
sizeof(nsapi_request_context));
+       if (!request_context) {
+               log_error(LOG_CATASTROPHE, pblock_findval("fn", pb), sn, rq, 
"Insufficient memory to process PHP request!");
+               return REQ_ABORTED;
+       }
        request_context->pb = pb;
        request_context->sn = sn;
        request_context->rq = rq;
@@ -1064,7 +1068,7 @@
        nsapi_free(SG(request_info).path_translated);
        nsapi_free((void*)(SG(request_info).content_type));
 
-       FREE(request_context);
+       pool_free(sn->pool, request_context);
        SG(server_context) = NULL;
 
        return retval;
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to