Bug 52893 - Code clean up (various)
Summary: Code clean up (various)
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.5-HEAD
Hardware: PC Windows 2000
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2012-03-12 21:38 UTC by Christophe JAILLET
Modified: 2012-07-15 21:15 UTC (History)
0 users



Attachments
Proposed patch (8.44 KB, patch)
2012-03-12 21:38 UTC, Christophe JAILLET
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe JAILLET 2012-03-12 21:38:47 UTC
Created attachment 28456 [details]
Proposed patch

Hi, here is a set of small modification that improve a bit, IMO, the source code.
Feel free to merge it to trunk or not.

Hope this helps.
Best regards,

CJ

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

 modules/aaa/mod_authz_core.c  |    9 +++------
 modules/http/http_protocol.c  |    8 ++------
 modules/lua/mod_lua.c         |    7 +++----
 modules/proxy/mod_proxy_ftp.c |    7 +++----
 modules/proxy/proxy_util.c    |    2 +-
 modules/session/mod_session.c |    2 +-
 modules/test/mod_policy.c     |    9 ++++++---
 server/core.c                 |    4 ++--
 server/provider.c             |    4 ++--
 9 files changed, 23 insertions(+), 29 deletions(-)

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

modules/lua/mod_lua.c
   - concat a call to apr_snprintf followed by apr_pstrcat into a single apr_psprintf in order to improve readability.


modules/session/mod_session.c
   - there is no need to call apr_pstrcat in order to strcat only one string ! Use apr_pstrdup instead


modules/proxy/mod_proxy_ftp.c
   - no need to use a local variable here, do it the same way as for 'user' a few line above
   - no need to call apr_pstrcat to concat string literal. Do a direct assignment as two lines below


modules/aaa/mod_authz_core.c
   - reorder the way the message is generated in order to avoid a call to apr_pstrcat. This way of building the error message is much more consistent with the rest of the code source


modules/proxy/proxy_util.c
   - no need to apr_pstrdup constant string here


modules/http/http_protocol.c
   - remove a spurious comment. TRACE seems to be handled only if (conf->trace_enable != AP_TRACE_DISABLE)
   - all allowed methods are collected into a apr array, so why not use it untill the end of the function ? Remove "recursive" calls to apr_pstrcat in order to same memory and improve readability


modules/test/mod_policy.c
   - do not have nested apr_pstrcat calls, because it duplicates memory. Reorder the code to improve readability instead.


server/core.c
   - build IPv6 server name as in other parts on the code. prefer 
   - formatting (missing spaces)


server/provider.c
   - do not ask for a parameter that it not used
Comment 1 Stefan Fritsch 2012-07-15 21:15:56 UTC
Thank. Committed as r1361801 with some more tweaks:

modules/http/http_protocol.c: further simplification
modules/test/mod_policy.c: further simplification
modules/proxy/mod_proxy_ftp.c: revert one part because it causes compiler warning about discarded constness