You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Kurt Brown <ku...@yahoo.com> on 2001/11/17 23:54:54 UTC

apache-api/8791: ap_custom_response() function could use "const char *" instead of "char *"

>Number:         8791
>Category:       apache-api
>Synopsis:       ap_custom_response() function could use "const char *" instead of "char *"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Sat Nov 17 15:00:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     kurtb149@yahoo.com
>Release:        2.0.29-dev
>Organization:
apache
>Environment:
$ uname -a
Linux dirac.netpos.com 2.4.7-10 #1 Thu Sep 6 16:46:36 EDT 2001 i686 unknown

$ cc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
>Description:
I suggest changing the signature of ap_custom_response() to use a "const char *" instead of a "char *". Such a change would better support c++ std::string.
>How-To-Repeat:

>Fix:
$ cvs diff -u include/http_core.h server/core.c

Index: include/http_core.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/http_core.h,v
retrieving revision 1.52
diff -u -r1.52 http_core.h
--- include/http_core.h 2001/09/17 21:07:35     1.52
+++ include/http_core.h 2001/11/17 22:39:20
@@ -254,7 +254,7 @@
  *               or a URL
  * @deffunc void ap_custom_response(request_rec *r, int status, char *string)
  */
-AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string);
+AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
 
 /**
  * Check for a definition from the server command line
Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.98
diff -u -r1.98 core.c
--- server/core.c       2001/11/15 20:49:53     1.98
+++ server/core.c       2001/11/17 22:39:23
@@ -943,7 +943,7 @@
     return NULL;
 }
 
-AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string)
+AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string)
 {
     core_dir_config *conf = 
        ap_get_module_config(r->per_dir_config, &core_module);

>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 


Re: apache-api/8791: ap_custom_response() function could use "const char *" instead of "char *"

Posted by Ian Holsman <ia...@apache.org>.
Thanks Kurt.
your patch has been comitted.

Kurt Brown wrote:

>>Number:         8791
>>Category:       apache-api
>>Synopsis:       ap_custom_response() function could use "const char *" instead of "char *"
>>Confidential:   no
>>Severity:       non-critical
>>Priority:       medium
>>Responsible:    apache
>>State:          open
>>Quarter:        
>>Keywords:       
>>Date-Required:
>>Class:          change-request
>>Submitter-Id:   apache
>>Arrival-Date:   Sat Nov 17 15:00:00 PST 2001
>>Closed-Date:
>>Last-Modified:
>>Originator:     kurtb149@yahoo.com
>>Release:        2.0.29-dev
>>Organization:
>>
> apache
> 
>>Environment:
>>
> $ uname -a
> Linux dirac.netpos.com 2.4.7-10 #1 Thu Sep 6 16:46:36 EDT 2001 i686 unknown
> 
> $ cc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
> 
>>Description:
>>
> I suggest changing the signature of ap_custom_response() to use a "const char *" instead of a "char *". Such a change would better support c++ std::string.
> 
>>How-To-Repeat:
>>
> 
>>Fix:
>>
> $ cvs diff -u include/http_core.h server/core.c
> 
> Index: include/http_core.h
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/include/http_core.h,v
> retrieving revision 1.52
> diff -u -r1.52 http_core.h
> --- include/http_core.h 2001/09/17 21:07:35     1.52
> +++ include/http_core.h 2001/11/17 22:39:20
> @@ -254,7 +254,7 @@
>   *               or a URL
>   * @deffunc void ap_custom_response(request_rec *r, int status, char *string)
>   */
> -AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string);
> +AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
>  
>  /**
>   * Check for a definition from the server command line
> Index: server/core.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
> retrieving revision 1.98
> diff -u -r1.98 core.c
> --- server/core.c       2001/11/15 20:49:53     1.98
> +++ server/core.c       2001/11/17 22:39:23
> @@ -943,7 +943,7 @@
>      return NULL;
>  }
>  
> -AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string)
> +AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string)
>  {
>      core_dir_config *conf = 
>         ap_get_module_config(r->per_dir_config, &core_module);
> 
> 
>>Release-Note:
>>Audit-Trail:
>>Unformatted:
>>
>  [In order for any reply to be added to the PR database, you need]
>  [to include <ap...@Apache.Org> in the Cc line and make sure the]
>  [subject line starts with the report component and number, with ]
>  [or without any 'Re:' prefixes (such as "general/1098:" or      ]
>  ["Re: general/1098:").  If the subject doesn't match this       ]
>  [pattern, your message will be misfiled and ignored.  The       ]
>  ["apbugs" address is not added to the Cc line of messages from  ]
>  [the database automatically because of the potential for mail   ]
>  [loops.  If you do not include this Cc, your reply may be ig-   ]
>  [nored unless you are responding to an explicit request from a  ]
>  [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
>  
>  
>