+- 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 @@