Hi

This removes the _status_ functions and list, all unused, from mk_http.c.

Besides cleaner code, runtime RAM use drops by 1.3kb.

- Lauri
>From d0978bf36c826f7e4a7c7b5a37531ad59239c277 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Tue, 8 May 2012 19:26:05 +0300
Subject: [PATCH] http: Remove the _status_ functions and list, all unused

Besides cleaner code, runtime RAM use drops by 1.3kb.

Signed-off-by: Lauri Kasanen <[email protected]>
---
 src/include/mk_http.h        |    2 -
 src/include/mk_http_status.h |    2 -
 src/mk_http.c                |   63 ------------------------------------------
 src/mk_memory.c              |    1 -
 4 files changed, 0 insertions(+), 68 deletions(-)

diff --git a/src/include/mk_http.h b/src/include/mk_http.h
index 3ac99a9..c5062a9 100644
--- a/src/include/mk_http.h
+++ b/src/include/mk_http.h
@@ -77,8 +77,6 @@ int mk_http_directory_redirect_check(struct client_session 
*cs,
 int mk_http_range_set(struct session_request *sr, long file_size);
 int mk_http_range_parse(struct session_request *sr);
 
-mk_pointer *mk_http_status_get(short int code);
-void mk_http_status_list_init(void);
 int mk_http_pending_request(struct client_session *cs);
 int mk_http_send_file(struct client_session *cs, struct session_request *sr);
 int mk_http_request_end(int socket);
diff --git a/src/include/mk_http_status.h b/src/include/mk_http_status.h
index 16fa436..5052447 100644
--- a/src/include/mk_http_status.h
+++ b/src/include/mk_http_status.h
@@ -80,6 +80,4 @@
 /* Text header messages */
 #define M_HTTP_OK_TXT                          "HTTP/1.1 200 OK\r\n"
 
-mk_list_sint_t *mk_http_status_list;
-
 #endif
diff --git a/src/mk_http.c b/src/mk_http.c
index 8cb8020..0f976c4 100644
--- a/src/mk_http.c
+++ b/src/mk_http.c
@@ -687,69 +687,6 @@ int mk_http_pending_request(struct client_session *cs)
     return 0;
 }
 
-mk_pointer *mk_http_status_get(short int code)
-{
-    mk_list_sint_t *l;
-
-    l = mk_http_status_list;
-    while (l) {
-        if (l->index == code) {
-            return &l->value;
-        }
-        else {
-            l = l->next;
-        }
-    }
-
-    return NULL;
-}
-
-void mk_http_status_add(short int val[2])
-{
-    short i, len = 6;
-    char *str_val;
-    mk_list_sint_t *list, *new;
-
-    for (i = val[0]; i <= val[1]; i++) {
-
-        new = mk_mem_malloc(sizeof(mk_list_sint_t));
-        new->index = i;
-        new->next = NULL;
-
-        str_val = mk_mem_malloc(6);
-        snprintf(str_val, len - 1, "%i", i);
-
-        new->value.data = str_val;
-        new->value.len = 3;
-
-        if (!mk_http_status_list) {
-            mk_http_status_list = new;
-        }
-        else {
-            list = mk_http_status_list;
-            while (list->next)
-                list = list->next;
-
-            list->next = new;
-            list = new;
-        }
-    }
-}
-
-void mk_http_status_list_init()
-{
-    /* Status type */
-    short int success[2] = { 200, 206 };
-    short int redirections[2] = { 300, 305 };
-    short int client_errors[2] = { 400, 415 };
-    short int server_errors[2] = { 500, 505 };
-
-    mk_http_status_add(success);
-    mk_http_status_add(redirections);
-    mk_http_status_add(client_errors);
-    mk_http_status_add(server_errors);
-}
-
 int mk_http_request_end(int socket)
 {
     int ka;
diff --git a/src/mk_memory.c b/src/mk_memory.c
index 839c636..df71a1d 100644
--- a/src/mk_memory.c
+++ b/src/mk_memory.c
@@ -173,7 +173,6 @@ void mk_mem_pointers_init()
     mk_pointer_set(&mk_header_te_chunked, MK_HEADER_TE_CHUNKED);
     mk_pointer_set(&mk_header_last_modified, MK_HEADER_LAST_MODIFIED);
 
-    mk_http_status_list_init();
     mk_iov_separators_init();
 
     /* Server */
-- 
1.7.2.1

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to