httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1131465 - in /httpd/httpd/trunk: include/ap_mmn.h include/http_protocol.h server/protocol.c
Date Sat, 04 Jun 2011 18:50:55 GMT
Author: sf
Date: Sat Jun  4 18:50:55 2011
New Revision: 1131465

URL: http://svn.apache.org/viewvc?rev=1131465&view=rev
Log:
Make ap_rputs an inline function, as it is mostly used with string constants
and this allows the compiler to optimize the strlen() call away.

Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_protocol.h
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1131465&r1=1131464&r2=1131465&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sat Jun  4 18:50:55 2011
@@ -325,14 +325,15 @@
  * 20110329.5 (2.3.13-dev) Add ap_regexec_len()
  * 20110329.6 (2.3.13-dev) Add AP_EXPR_FLAGS_RESTRICTED, ap_expr_eval_ctx_t->data,
  *                         ap_expr_exec_ctx()
+ * 20110604.0 (2.3.13-dev) Make ap_rputs() inline
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20110329
+#define MODULE_MAGIC_NUMBER_MAJOR 20110604
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 6                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=1131465&r1=1131464&r2=1131465&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Sat Jun  4 18:50:55 2011
@@ -319,21 +319,25 @@ AP_DECLARE(void) ap_set_content_type(req
 AP_DECLARE(int) ap_rputc(int c, request_rec *r);
 
 /**
- * Output a string for the current request
- * @param str The string to output
+ * Write a buffer for the current request
+ * @param buf The buffer to write
+ * @param nbyte The number of bytes to send from the buffer
  * @param r The current request
  * @return The number of bytes sent
  */
-AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
+AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
 
 /**
- * Write a buffer for the current request
- * @param buf The buffer to write
- * @param nbyte The number of bytes to send from the buffer
+ * Output a string for the current request
+ * @param str The string to output
  * @param r The current request
  * @return The number of bytes sent
+ * @note ap_rputs may be implemented as macro or inline function
  */
-AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
+static inline int ap_rputs(const char *str, request_rec *r)
+{
+    return ap_rwrite(str, strlen(str), r);
+}
 
 /**
  * Write an unspecified number of strings to the request

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1131465&r1=1131464&r2=1131465&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Sat Jun  4 18:50:55 2011
@@ -1509,19 +1509,6 @@ AP_DECLARE(int) ap_rputc(int c, request_
     return c;
 }
 
-AP_DECLARE(int) ap_rputs(const char *str, request_rec *r)
-{
-    apr_size_t len;
-
-    if (r->connection->aborted)
-        return -1;
-
-    if (buffer_output(r, str, len = strlen(str)) != APR_SUCCESS)
-        return -1;
-
-    return len;
-}
-
 AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
 {
     if (r->connection->aborted)



Mime
View raw message