+@@ -461,27 +461,27 @@
+ }
+
+ if (fcgi_socket_dir) {
+- return ap_psprintf(tp, "%s %s: already defined as \"%s\"",
++ return apr_psprintf(tp, "%s %s: already defined as \"%s\"",
+ name, arg, fcgi_socket_dir);
+ }
+
+ err = fcgi_config_set_fcgi_uid_n_gid(1);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, arg, err);
++ return apr_psprintf(tp, "%s %s: %s", name, arg, err);
+
+ if (fcgi_servers != NULL) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "The %s command must preceed static FastCGI server definitions",
+ name);
+ }
+
+- arg_nc = ap_pstrdup(cmd->pool, arg);
++ arg_nc = apr_pstrdup(cmd->pool, arg);
+
+ #ifndef WIN32
+
+ #ifdef APACHE2
+ if (apr_filepath_merge(&arg_nc, "", arg, 0, cmd->pool))
+- return ap_psprintf(tp, "%s %s: invalid filepath", name, arg);
++ return apr_psprintf(tp, "%s %s: invalid filepath", name, arg);
+ #else
+ arg_nc = ap_os_canonical_filename(cmd->pool, arg_nc);
+ #endif
+@@ -491,22 +491,22 @@
+ #else /* WIN32 */
+
+ if (strncmp(arg_nc, "\\\\.\\pipe\\", 9) != 0)
+- return ap_psprintf(tp, "%s %s is invalid format",name, arg_nc);
++ return apr_psprintf(tp, "%s %s is invalid format",name, arg_nc);
+
+ #endif
+
+ fcgi_socket_dir = arg_nc;
+
+ #ifdef WIN32
+- fcgi_dynamic_dir = ap_pstrcat(cmd->pool, fcgi_socket_dir, "dynamic", NULL);
++ fcgi_dynamic_dir = apr_pstrcat(cmd->pool, fcgi_socket_dir, "dynamic", NULL);
+ #else
+ err = fcgi_config_make_dir(tp, fcgi_socket_dir);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, arg_nc, err);
++ return apr_psprintf(tp, "%s %s: %s", name, arg_nc, err);
+
+ err = fcgi_config_make_dynamic_dir(cmd->pool, 0);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, arg_nc, err);
++ return apr_psprintf(tp, "%s %s: %s", name, arg_nc, err);
+ #endif
+
+ return NULL;
+@@ -519,7 +519,7 @@
+ const char *fcgi_config_set_wrapper(cmd_parms *cmd, void *dummy, const char *arg)
+ {
+ #ifdef WIN32
+- return ap_psprintf(cmd->temp_pool,
++ return apr_psprintf(cmd->temp_pool,
+ "the %s directive is not supported on WIN", cmd->cmd->name);
+ #else
+
+@@ -536,16 +536,16 @@
+
+ if (fcgi_wrapper)
+ {
+- return ap_psprintf(tp, "%s was already set to \"%s\"",
++ return apr_psprintf(tp, "%s was already set to \"%s\"",
+ name, fcgi_wrapper);
+ }
+
+ err = fcgi_config_set_fcgi_uid_n_gid(1);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, arg, err);
++ return apr_psprintf(tp, "%s %s: %s", name, arg, err);
+
+ if (fcgi_servers != NULL) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "The %s command must preceed static FastCGI server definitions", name);
+ }
+
+@@ -562,7 +562,7 @@
+ {
+ #ifdef APACHE2
+ if (apr_filepath_merge(&wrapper, "", arg, 0, cmd->pool))
+- return ap_psprintf(tp, "%s %s: invalid filepath", name, arg);
++ return apr_psprintf(tp, "%s %s: invalid filepath", name, arg);
+ #else
+ wrapper = ap_os_canonical_filename(cmd->pool, (char *) arg);
+ #endif
+@@ -573,7 +573,7 @@
+ err = fcgi_util_check_access(tp, wrapper, NULL, X_OK, fcgi_user_id, fcgi_group_id);
+ if (err)
+ {
+- return ap_psprintf(tp, "%s: \"%s\" execute access for server "
++ return apr_psprintf(tp, "%s: \"%s\" execute access for server "
+ "(uid %ld, gid %ld) failed: %s", name, wrapper,
+ (long) fcgi_user_id, (long) fcgi_group_id, err);
+ }
+@@ -596,7 +596,7 @@
+ const char *option, *err;
+
+ /* Allocate temp storage for the array of initial environment variables */
+- char **envp = ap_pcalloc(tp, sizeof(char *) * (MAX_INIT_ENV_VARS + 3));
++ char **envp = apr_pcalloc(tp, sizeof(char *) * (MAX_INIT_ENV_VARS + 3));
+ unsigned int envc = 0;
+
+ #ifdef WIN32
+@@ -613,11 +613,11 @@
+ return "AppClass requires a pathname!?";
+
+ if ((err = fcgi_config_set_fcgi_uid_n_gid(1)) != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+
+ #ifdef APACHE2
+ if (apr_filepath_merge(&fs_path, "", fs_path, 0, p))
+- return ap_psprintf(tp, "%s %s: invalid filepath", name, fs_path);
++ return apr_psprintf(tp, "%s %s: invalid filepath", name, fs_path);
+ #else
+ fs_path = ap_os_canonical_filename(p, fs_path);
+ #endif
+@@ -631,14 +631,14 @@
+ fcgi_util_get_server_gid(cmd->server));
+ if (s != NULL) {
+ if (fcgi_wrapper) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s: redefinition of a previously defined FastCGI "
+ "server \"%s\" with uid=%ld and gid=%ld",
+ name, fs_path, (long) fcgi_util_get_server_uid(cmd->server),
+ (long) fcgi_util_get_server_gid(cmd->server));
+ }
+ else {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s: redefinition of a previously defined FastCGI server \"%s\"",
+ name, fs_path);
+ }
+@@ -646,7 +646,7 @@
+
+ err = fcgi_util_fs_is_path_ok(tp, fs_path, NULL);
+ if (err != NULL) {
+- return ap_psprintf(tp, "%s: \"%s\" %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s: \"%s\" %s", name, fs_path, err);
+ }
+
+ s = fcgi_util_fs_new(p);
+@@ -672,7 +672,7 @@
+
+ SetHandleInformation(mutex, HANDLE_FLAG_INHERIT, TRUE);
+
+- s->mutex_env_string = ap_psprintf(p, "_FCGI_MUTEX_=%ld", mutex);
++ s->mutex_env_string = apr_psprintf(p, "_FCGI_MUTEX_=%ld", mutex);
+
+ #endif
+
+@@ -730,7 +730,7 @@
+ }
+ else if (strcasecmp(option, "-user") == 0) {
+ #ifdef WIN32
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: the -user option isn't supported on WIN", name, fs_path);
+ #else
+ s->user = ap_getword_conf(tp, &arg);
+@@ -740,7 +740,7 @@
+ }
+ else if (strcasecmp(option, "-group") == 0) {
+ #ifdef WIN32
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: the -group option isn't supported on WIN", name, fs_path);
+ #else
+ s->group = ap_getword_conf(tp, &arg);
+@@ -749,7 +749,7 @@
+ #endif
+ }
+ else {
+- return ap_psprintf(tp, "%s %s: invalid option: %s", name, fs_path, option);
++ return apr_psprintf(tp, "%s %s: invalid option: %s", name, fs_path, option);
+ }
+ } /* while */
+
+@@ -758,12 +758,12 @@
+ {
+ if (s->group == NULL)
+ {
+- s->group = ap_psprintf(tp, "#%ld", fcgi_util_get_server_gid(cmd->server));
++ s->group = apr_psprintf(tp, "#%ld", fcgi_util_get_server_gid(cmd->server));
+ }
+
+ if (s->user == NULL)
+ {
+- s->user = ap_psprintf(p, "#%ld", fcgi_util_get_server_uid(cmd->server));
++ s->user = apr_psprintf(p, "#%ld", fcgi_util_get_server_uid(cmd->server));
+ }
+
+ s->uid = ap_uname2id(s->user);
+@@ -777,19 +777,19 @@
+
+ if ((err = fcgi_util_fs_set_uid_n_gid(p, s, s->uid, s->gid)))
+ {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: invalid user or group: %s", name, fs_path, err);
+ }
+ #endif /* !WIN32 */
+
+ if (s->socket_path != NULL && s->port != 0) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: -port and -socket are mutually exclusive options",
+ name, fs_path);
+ }
+
+ /* Move env array to a surviving pool */
+- s->envp = (char **)ap_pcalloc(p, sizeof(char *) * (envc + 4));
++ s->envp = (char **)apr_pcalloc(p, sizeof(char *) * (envc + 4));
+ memcpy(s->envp, envp, sizeof(char *) * envc);
+
+ /* Initialize process structs */
+@@ -800,12 +800,12 @@
+ err = fcgi_util_socket_make_inet_addr(p, (struct sockaddr_in **)&s->socket_addr,
+ &s->socket_addr_len, NULL, s->port);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+ #ifdef WIN32
+ err = fcgi_util_socket_make_inet_addr(p, (struct sockaddr_in **)&s->dest_addr,
+ &s->socket_addr_len, "localhost", s->port);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+ #endif
+ } else {
+ if (s->socket_path == NULL)
+@@ -825,7 +825,7 @@
+ err = fcgi_util_socket_make_domain_addr(p, (struct sockaddr_un **)&s->socket_addr,
+ &s->socket_addr_len, s->socket_path);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+ #endif
+ }
+
+@@ -853,12 +853,12 @@
+ }
+
+ if (!*fs_path) {
+- return ap_pstrcat(tp, name, " requires a path and either a -socket or -host option", NULL);
++ return apr_pstrcat(tp, name, " requires a path and either a -socket or -host option", NULL);
+ }
+
+ #ifdef APACHE2
+ if (apr_filepath_merge(&fs_path, "", fs_path, 0, p))
+- return ap_psprintf(tp, "%s %s: invalid filepath", name, fs_path);
++ return apr_psprintf(tp, "%s %s: invalid filepath", name, fs_path);
+ #else
+ fs_path = ap_os_canonical_filename(p, fs_path);
+ #endif
+@@ -873,7 +873,7 @@
+ fcgi_util_get_server_gid(cmd->server));
+ if (s != NULL) {
+ if (fcgi_wrapper) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s: redefinition of a previously defined class \"%s\" "
+ "with uid=%ld and gid=%ld",
+ name, fs_path, (long) fcgi_util_get_server_uid(cmd->server),
+@@ -881,7 +881,7 @@
+ }
+ else
+ {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s: redefinition of previously defined class \"%s\"", name, fs_path);
+ }
+ }
+@@ -920,7 +920,7 @@
+ }
+ else if (strcasecmp(option, "-user") == 0) {
+ #ifdef WIN32
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: the -user option isn't supported on WIN", name, fs_path);
+ #else
+ s->user = ap_getword_conf(tp, &arg);
+@@ -930,7 +930,7 @@
+ }
+ else if (strcasecmp(option, "-group") == 0) {
+ #ifdef WIN32
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: the -group option isn't supported on WIN", name, fs_path);
+ #else
+ s->group = ap_getword_conf(tp, &arg);
+@@ -939,7 +939,7 @@
+ #endif
+ }
+ else {
+- return ap_psprintf(tp, "%s %s: invalid option: %s", name, fs_path, option);
++ return apr_psprintf(tp, "%s %s: invalid option: %s", name, fs_path, option);
+ }
+ } /* while */
+
+@@ -949,12 +949,12 @@
+ {
+ if (s->group == NULL)
+ {
+- s->group = ap_psprintf(tp, "#%ld", fcgi_util_get_server_gid(cmd->server));
++ s->group = apr_psprintf(tp, "#%ld", fcgi_util_get_server_gid(cmd->server));
+ }
+
+ if (s->user == NULL)
+ {
+- s->user = ap_psprintf(p, "#%ld", fcgi_util_get_server_uid(cmd->server));
++ s->user = apr_psprintf(p, "#%ld", fcgi_util_get_server_uid(cmd->server));
+ }
+
+ s->uid = ap_uname2id(s->user);
+@@ -968,19 +968,19 @@
+
+ if ((err = fcgi_util_fs_set_uid_n_gid(p, s, s->uid, s->gid)))
+ {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: invalid user or group: %s", name, fs_path, err);
+ }
+ #endif /* !WIN32 */
+
+ /* Require one of -socket or -host, but not both */
+ if (s->socket_path != NULL && s->port != 0) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: -host and -socket are mutually exclusive options",
+ name, fs_path);
+ }
+ if (s->socket_path == NULL && s->port == 0) {
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s %s: -socket or -host option missing", name, fs_path);
+ }
+
+@@ -989,7 +989,7 @@
+ err = fcgi_util_socket_make_inet_addr(p, (struct sockaddr_in **)&s->socket_addr,
+ &s->socket_addr_len, s->host, s->port);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+ } else {
+
+ if (fcgi_socket_dir == NULL)
+@@ -1006,7 +1006,7 @@
+ err = fcgi_util_socket_make_domain_addr(p, (struct sockaddr_un **)&s->socket_addr,
+ &s->socket_addr_len, s->socket_path);
+ if (err != NULL)
+- return ap_psprintf(tp, "%s %s: %s", name, fs_path, err);
++ return apr_psprintf(tp, "%s %s: %s", name, fs_path, err);
+ #endif
+ }
+
+@@ -1037,7 +1037,7 @@
+
+ /* Allocate temp storage for an initial environment */
+ unsigned int envc = 0;
+- char **envp = (char **)ap_pcalloc(tp, sizeof(char *) * (MAX_INIT_ENV_VARS + 3));
++ char **envp = (char **)apr_pcalloc(tp, sizeof(char *) * (MAX_INIT_ENV_VARS + 3));
+
+ err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+ if (err)
+@@ -1131,20 +1131,20 @@
+ dynamicFlush = TRUE;
+ }
+ else {
+- return ap_psprintf(tp, "%s: invalid option: %s", name, option);
++ return apr_psprintf(tp, "%s: invalid option: %s", name, option);
+ }
+ } /* while */
+
+ if (dynamicProcessSlack >= dynamicMaxProcs + 1) {
+ /* the kill policy would work unexpectedly */
+- return ap_psprintf(tp,
++ return apr_psprintf(tp,
+ "%s: processSlack (%u) must be less than maxProcesses (%u) + 1",
+ name, dynamicProcessSlack, dynamicMaxProcs);
+ }
+
+ /* Move env array to a surviving pool, leave 2 extra slots for
+ * WIN32 _FCGI_MUTEX_ and _FCGI_SHUTDOWN_EVENT_ */
+- dynamicEnvp = (char **)ap_pcalloc(p, sizeof(char *) * (envc + 4));
++ dynamicEnvp = (char **)apr_pcalloc(p, sizeof(char *) * (envc + 4));
+ memcpy(dynamicEnvp, envp, sizeof(char *) * envc);
+
+ return NULL;
+@@ -1152,7 +1152,7 @@
+
+ void *fcgi_config_create_dir_config(pool *p, char *dummy)
+ {
+- fcgi_dir_config *dir_config = ap_pcalloc(p, sizeof(fcgi_dir_config));
++ fcgi_dir_config *dir_config = apr_pcalloc(p, sizeof(fcgi_dir_config));
+
+ dir_config->authenticator_options = FCGI_AUTHORITATIVE;
+ dir_config->authorizer_options = FCGI_AUTHORITATIVE;
+@@ -1171,7 +1171,7 @@
+
+ #ifdef APACHE2
+ if (apr_filepath_merge(&auth_server, "", fs_path, 0, cmd->pool))
+- return ap_psprintf(tp, "%s %s: invalid filepath", cmd->cmd->name, fs_path);
++ return apr_psprintf(tp, "%s %s: invalid filepath", cmd->cmd->name, fs_path);
+ #else
+ auth_server = (char *) ap_os_canonical_filename(cmd->pool, fs_path);
+ #endif
+@@ -1184,11 +1184,11 @@
+ {
+ const char *err = fcgi_util_fs_is_path_ok(tp, auth_server, NULL);
+ if (err)
+- return ap_psprintf(tp, "%s: \"%s\" %s", cmd->cmd->name, auth_server, err);
++ return apr_psprintf(tp, "%s: \"%s\" %s", cmd->cmd->name, auth_server, err);
+ }
+
+ if (compat && strcasecmp(compat, "-compat"))
+- return ap_psprintf(cmd->temp_pool, "%s: unknown option: \"%s\"", cmd->cmd->name, compat);
++ return apr_psprintf(cmd->temp_pool, "%s: unknown option: \"%s\"", cmd->cmd->name, compat);
+
+ switch((int)cmd->info) {
+ case FCGI_AUTH_TYPE_AUTHENTICATOR: