You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1998/01/11 12:58:05 UTC

[PATCH] unneeded pstrdup()s

These are all unneeded because there's an implicit pstrdup within the
table functions.  There's still more we can do in this area... but this is
a start.

Dean

Index: main/http_request.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_request.c,v
retrieving revision 1.98
diff -u -r1.98 http_request.c
--- http_request.c	1998/01/08 03:56:08	1.98
+++ http_request.c	1998/01/11 07:37:59
@@ -1217,7 +1217,7 @@
     new->read_length     = r->read_length;     /* We can only read it once */
 
     ap_snprintf(t, sizeof(t), "%d", r->status);
-    table_set(new->subprocess_env, "REDIRECT_STATUS", pstrdup(r->pool, t));
+    table_set(new->subprocess_env, "REDIRECT_STATUS", t);
 
     /*
      * XXX: hmm.  This is because mod_setenvif and mod_unique_id really need
Index: main/util_script.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util_script.c,v
retrieving revision 1.89
diff -u -r1.89 util_script.c
--- util_script.c	1998/01/10 05:43:33	1.89
+++ util_script.c	1998/01/11 07:38:01
@@ -348,7 +348,7 @@
 #ifdef WIN32
 	    /* We need to make this a real Windows path name */
 	    GetFullPathName(pt, HUGE_STRING_LEN, buffer, NULL);
-	    table_set(e, "PATH_TRANSLATED", pstrdup(r->pool, buffer));
+	    table_set(e, "PATH_TRANSLATED", buffer);
 #else
 	    table_set(e, "PATH_TRANSLATED", pt);
 #endif
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.58
diff -u -r1.58 mod_rewrite.c
--- mod_rewrite.c	1998/01/07 16:46:55	1.58
+++ mod_rewrite.c	1998/01/11 07:38:05
@@ -908,15 +908,13 @@
          var = pstrcat(r->pool, "REDIRECT_", ENVVAR_SCRIPT_URL, NULL);
          var = table_get(r->subprocess_env, var);
          if (var == NULL) 
-             table_set(r->subprocess_env, ENVVAR_SCRIPT_URL,
-                       pstrdup(r->pool, r->uri));
+             table_set(r->subprocess_env, ENVVAR_SCRIPT_URL, r->uri);
          else 
-             table_set(r->subprocess_env, ENVVAR_SCRIPT_URL,
-                       pstrdup(r->pool, var));
+             table_set(r->subprocess_env, ENVVAR_SCRIPT_URL, var);
     } 
     else {
          var = table_get(r->main->subprocess_env, ENVVAR_SCRIPT_URL);
-         table_set(r->subprocess_env, ENVVAR_SCRIPT_URL, pstrdup(r->pool, var));
+         table_set(r->subprocess_env, ENVVAR_SCRIPT_URL, var);
     }
 
     /*
@@ -945,7 +943,7 @@
 #else
     var = pstrcat(r->pool, "http://", thisserver, thisport, thisurl, NULL);
 #endif
-    table_set(r->subprocess_env, ENVVAR_SCRIPT_URI, pstrdup(r->pool, var));
+    table_set(r->subprocess_env, ENVVAR_SCRIPT_URI, var);
 
 
     /* if filename was not initially set,
@@ -3484,8 +3482,7 @@
         var[n] = '\0';
         strncpy(val, cp+1, sizeof(val)-1);
         EOS_PARANOIA(val);
-        table_set(r->subprocess_env, pstrdup(r->pool, var), 
-                  pstrdup(r->pool, val));
+        table_set(r->subprocess_env, var, val);
         rewritelog(r, 5, "setting env variable '%s' to '%s'", var, val);
     }
 }



Re: [PATCH] unneeded pstrdup()s

Posted by Marc Slemko <ma...@worldgate.com>.
On Sun, 11 Jan 1998, Dean Gaudet wrote:

> These are all unneeded because there's an implicit pstrdup within the
> table functions.  There's still more we can do in this area... but this is
> a start.

+1.


Re: [PATCH] unneeded pstrdup()s

Posted by Paul Sutton <pa...@eu.c2.net>.
On Sun, 11 Jan 1998, Dean Gaudet wrote:
> These are all unneeded because there's an implicit pstrdup within the
> table functions.  There's still more we can do in this area... but this is
> a start.

Yep, these all look good and work. +1 on doing this globally. 

//pcs