[Olsr-dev] [PATCH v1 048/115] info: rename some http header function parameters

Ferry Huberts (spam-protected)
Wed Dec 2 21:28:21 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/http_headers.c | 8 ++++----
 lib/info/http_headers.h | 4 ++--
 lib/info/olsrd_info.c   | 8 ++++----
 lib/info/olsrd_info.h   | 2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/info/http_headers.c b/lib/info/http_headers.c
index 9a6d5a6..a9195f3 100644
--- a/lib/info/http_headers.c
+++ b/lib/info/http_headers.c
@@ -41,7 +41,7 @@
 
 #include "http_headers.h"
 
-void build_http_header(const char *plugin_name, const char *status, const char *mime, struct autobuf *abuf, int *contentLengthPlaceholderStart) {
+void build_http_header(const char *plugin_name, const char *status, const char *mime, struct autobuf *abuf, int *contentLengthIndex) {
   /* Status */
   abuf_appendf(abuf, "%s\r\n", status);
 
@@ -76,7 +76,7 @@ void build_http_header(const char *plugin_name, const char *status, const char *
 
   /* Content length */
   abuf_puts(abuf, "Content-Length: ");
-  *contentLengthPlaceholderStart = abuf->len;
+  *contentLengthIndex = abuf->len;
   abuf_puts(abuf, "            "); /* 12 spaces reserved for the length (max. 1TB-1), to be filled at the end */
   abuf_puts(abuf, "\r\n");
 
@@ -89,11 +89,11 @@ void build_http_header(const char *plugin_name, const char *status, const char *
   abuf_puts(abuf, "\r\n");
 }
 
-void http_header_adjust_content_length(struct autobuf *abuf, int contentLengthPlaceholderStart, int contentLength) {
+void http_header_adjust_content_length(struct autobuf *abuf, int contentLengthIndex, int contentLength) {
   char buf[12 + 1]; /* size must match to number of spaces used (+1 for the terminating byte) */
 
   memset(buf, 0, sizeof(buf));
   snprintf(buf, sizeof(buf), "%d", contentLength);
   buf[sizeof(buf) - 1] = '\0';
-  memcpy(&abuf->buf[contentLengthPlaceholderStart], buf, strlen(buf));
+  memcpy(&abuf->buf[contentLengthIndex], buf, strlen(buf));
 }
diff --git a/lib/info/http_headers.h b/lib/info/http_headers.h
index a5c96ab..221e70b 100644
--- a/lib/info/http_headers.h
+++ b/lib/info/http_headers.h
@@ -47,8 +47,8 @@
 /* Response types */
 #define HTTP_200 "HTTP/1.1 200 OK"
 
-void build_http_header(const char * plugin_name, const char *status, const char *mime, struct autobuf *abuf, int *contentLengthPlaceholderStart);
+void build_http_header(const char * plugin_name, const char *status, const char *mime, struct autobuf *abuf, int *contentLengthIndex);
 
-void http_header_adjust_content_length(struct autobuf *abuf, int contentLengthPlaceholderStart, int contentLength);
+void http_header_adjust_content_length(struct autobuf *abuf, int contentLengthIndex, int contentLength);
 
 #endif /* _OLSRD_INFO_COMMON_HTTP_HEADERS */
diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index 20a58f5..275a600 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -46,7 +46,7 @@
 #include "olsr.h"
 #include "scheduler.h"
 #include "ipcalc.h"
-#include "../../info/http_headers.h"
+#include "http_headers.h"
 
 #ifdef _WIN32
 #define close(x) closesocket(x)
@@ -171,13 +171,13 @@ static void send_info(unsigned int send_what, int the_socket) {
   struct autobuf abuf;
 
   const char *content_type = ((*printer_functions).determine_mime_type) ? (*(*printer_functions).determine_mime_type)(send_what) : "text/plain; charset=utf-8";
-  int contentLengthPlaceholderStart = 0;
+  int contentLengthIndex = 0;
   int headerLength = 0;
 
   abuf_init(&abuf, 2 * 4096);
 
   if (info_plugin_config->http_headers) {
-    build_http_header(PLUGIN_NAME, HTTP_200, content_type, &abuf, &contentLengthPlaceholderStart);
+    build_http_header(PLUGIN_NAME, HTTP_200, content_type, &abuf, &contentLengthIndex);
     headerLength = abuf.len;
   }
 
@@ -221,7 +221,7 @@ static void send_info(unsigned int send_what, int the_socket) {
   }
 
   if (info_plugin_config->http_headers) {
-    http_header_adjust_content_length(&abuf, contentLengthPlaceholderStart, abuf.len - headerLength);
+    http_header_adjust_content_length(&abuf, contentLengthIndex, abuf.len - headerLength);
   }
 
   /* avoid a memcpy: just move the abuf.buf pointer and clear abuf */
diff --git a/lib/info/olsrd_info.h b/lib/info/olsrd_info.h
index e9c7efb..382d14d 100644
--- a/lib/info/olsrd_info.h
+++ b/lib/info/olsrd_info.h
@@ -42,7 +42,7 @@
 #ifndef _OLSRD_INFO_INFO_H
 #define _OLSRD_INFO_INFO_H
 
-#include "../../info/info_types.h"
+#include "info_types.h"
 
 int info_plugin_init(const char * plugin_name, printer_functions_t *functions, info_plugin_config_t *config);
 void info_plugin_exit(void);
-- 
2.5.0




More information about the Olsr-dev mailing list