public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Add static to local functions and some cleanup
macournoyer (author)
Tue Apr 01 20:00:53 -0700 2008
commit  7907423cf6720a0e668b3075092385f72c8c9dde
tree    4ef53ec0e61dab065c9449c449ad2227d7570787
parent  98bf07fdc946dc09e161678f2ff075d11bcd05bf
...
6
7
8
9
 
10
11
12
...
98
99
100
101
 
102
103
104
...
6
7
8
 
9
10
11
12
...
98
99
100
 
101
102
103
104
0
@@ -6,7 +6,7 @@
0
 
0
 /* event callbacks */
0
 
0
-void thin_backend_accept_cb(EV_P_ struct ev_io *watcher, int revents)
0
+static void thin_backend_accept_cb(EV_P_ struct ev_io *watcher, int revents)
0
 {
0
   thin_backend_t *server = get_ev_data(backend, watcher, accept);
0
   struct sockaddr_in remote_addr;
0
@@ -98,7 +98,7 @@
0
   return Qtrue;
0
 }
0
 
0
-void thin_backend_free(thin_backend_t *backend)
0
+static void thin_backend_free(thin_backend_t *backend)
0
 {
0
   if (backend) {
0
     array_destroy(backend->connections);
...
14
15
16
17
 
18
19
20
21
22
23
24
 
25
26
27
...
43
44
45
46
 
47
48
49
...
14
15
16
 
17
18
19
20
21
22
23
 
24
25
26
27
...
43
44
45
 
46
47
48
49
0
@@ -14,14 +14,14 @@
0
 
0
 /* event callbacks */
0
 
0
-void thin_connection_closable_cb(EV_P_ struct ev_io *watcher, int revents)
0
+static void thin_connection_closable_cb(EV_P_ struct ev_io *watcher, int revents)
0
 {
0
   thin_connection_t *connection = get_ev_data(connection, watcher, write);
0
   
0
   thin_connection_close(connection);
0
 }
0
 
0
-void thin_connection_writable_cb(EV_P_ struct ev_io *watcher, int revents)
0
+static void thin_connection_writable_cb(EV_P_ struct ev_io *watcher, int revents)
0
 {
0
   thin_connection_t *connection = get_ev_data(connection, watcher, write);
0
   int sent;
0
@@ -43,7 +43,7 @@
0
   }
0
 }
0
 
0
-void thin_connection_readable_cb(EV_P_ struct ev_io *watcher, int revents)
0
+static void thin_connection_readable_cb(EV_P_ struct ev_io *watcher, int revents)
0
 {
0
   thin_connection_t *connection = get_ev_data(connection, watcher, read);
0
   size_t n;
...
 
 
1
2
3
4
5
6
7
 
8
9
10
...
12
13
14
15
 
16
17
18
...
38
39
40
41
 
42
43
44
...
1
2
3
4
5
6
7
8
 
9
10
11
12
...
14
15
16
 
17
18
19
20
...
40
41
42
 
43
44
45
46
0
@@ -1,10 +1,12 @@
0
+/* Allow reading connection->read_buffer from Ruby */
0
+
0
 #include "thin.h"
0
 
0
 static VALUE cInput;
0
 
0
 #define thin_buffer_to_s(buf) rb_str_new(buf->ptr, buf->len)
0
 
0
-VALUE thin_input_gets(VALUE self)
0
+static VALUE thin_input_gets(VALUE self)
0
 {
0
   thin_buffer_t *buf = NULL;
0
   DATA_GET(self, thin_buffer_t, buf);
0
@@ -12,7 +14,7 @@
0
   return thin_buffer_to_s(buf);
0
 }
0
 
0
-VALUE thin_input_read(int argc, VALUE *argv, VALUE self)
0
+static VALUE thin_input_read(int argc, VALUE *argv, VALUE self)
0
 {
0
   thin_buffer_t *buf = NULL;
0
   DATA_GET(self, thin_buffer_t, buf);
0
@@ -38,7 +40,7 @@
0
   return str;
0
 }
0
 
0
-VALUE thin_input_each(VALUE self)
0
+static VALUE thin_input_each(VALUE self)
0
 {
0
   thin_buffer_t *buf = NULL;
0
   DATA_GET(self, thin_buffer_t, buf);
...
18
19
20
21
22
23
24
...
27
28
29
30
 
31
32
33
...
49
50
51
52
 
53
54
55
...
58
59
60
61
 
62
63
64
...
67
68
69
70
 
71
72
73
...
76
77
78
79
 
80
81
82
...
86
87
88
89
 
90
91
92
...
95
96
97
98
 
99
100
101
...
105
106
107
108
 
109
110
111
...
146
147
148
149
 
150
151
152
...
159
160
161
162
 
163
164
165
...
186
187
188
189
190
191
192
...
18
19
20
 
21
22
23
...
26
27
28
 
29
30
31
32
...
48
49
50
 
51
52
53
54
...
57
58
59
 
60
61
62
63
...
66
67
68
 
69
70
71
72
...
75
76
77
 
78
79
80
81
...
85
86
87
 
88
89
90
91
...
94
95
96
 
97
98
99
100
...
104
105
106
 
107
108
109
110
...
145
146
147
 
148
149
150
151
...
158
159
160
 
161
162
163
164
...
185
186
187
 
188
189
190
0
@@ -18,7 +18,6 @@
0
 static VALUE global_server_protocol_value;
0
 static VALUE global_http_host;
0
 static VALUE global_port_80;
0
-static VALUE global_http_body;
0
 static VALUE global_url_scheme;
0
 static VALUE global_url_scheme_value;
0
 static VALUE global_script_name;
0
@@ -27,7 +26,7 @@
0
 /** Defines global strings in the init method. */
0
 #define DEF_GLOBAL(N, val) global_##N = rb_obj_freeze(rb_str_new2(val)); rb_global_variable(&global_##N)
0
 
0
-void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen)
0
+static void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen)
0
 {
0
   char *ch, *end;
0
   VALUE req = ((thin_connection_t*) data)->env;
0
@@ -49,7 +48,7 @@
0
   rb_hash_aset(req, f, v);
0
 }
0
 
0
-void request_method(void *data, const char *at, size_t length)
0
+static void request_method(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = Qnil;
0
@@ -58,7 +57,7 @@
0
   rb_hash_aset(req, global_request_method, val);
0
 }
0
 
0
-void request_uri(void *data, const char *at, size_t length)
0
+static void request_uri(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = Qnil;
0
@@ -67,7 +66,7 @@
0
   rb_hash_aset(req, global_request_uri, val);
0
 }
0
 
0
-void fragment(void *data, const char *at, size_t length)
0
+static void fragment(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = Qnil;
0
@@ -76,7 +75,7 @@
0
   rb_hash_aset(req, global_fragment, val);
0
 }
0
 
0
-void request_path(void *data, const char *at, size_t length)
0
+static void request_path(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = Qnil;
0
@@ -86,7 +85,7 @@
0
   rb_hash_aset(req, global_path_info, val);
0
 }
0
 
0
-void query_string(void *data, const char *at, size_t length)
0
+static void query_string(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = Qnil;
0
@@ -95,7 +94,7 @@
0
   rb_hash_aset(req, global_query_string, val);
0
 }
0
 
0
-void http_version(void *data, const char *at, size_t length)
0
+static void http_version(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = rb_str_new(at, length);
0
@@ -105,7 +104,7 @@
0
 /** Finalizes the request header to have a bunch of stuff that's
0
   needed. */
0
 
0
-void header_done(void *data, const char *at, size_t length)
0
+static void header_done(void *data, const char *at, size_t length)
0
 {
0
   thin_connection_t *connection = (thin_connection_t*) data;
0
   VALUE env = connection->env;
0
@@ -146,7 +145,7 @@
0
   rb_hash_aset(env, global_script_name, global_empty);
0
 }
0
 
0
-void content_length(void *data, const char *at, size_t length)
0
+static void content_length(void *data, const char *at, size_t length)
0
 {
0
   thin_connection_t *connection = (thin_connection_t*)(data);
0
   int i, mult;
0
@@ -159,7 +158,7 @@
0
   rb_hash_aset(connection->env, global_content_length, val);
0
 }
0
 
0
-void content_type(void *data, const char *at, size_t length)
0
+static void content_type(void *data, const char *at, size_t length)
0
 {
0
   VALUE req = ((thin_connection_t*) data)->env;
0
   VALUE val = rb_str_new(at, length);
0
@@ -186,7 +185,6 @@
0
   DEF_GLOBAL(server_protocol_value, "HTTP/1.1");
0
   DEF_GLOBAL(http_host, "HTTP_HOST");
0
   DEF_GLOBAL(port_80, "80");
0
- DEF_GLOBAL(http_body, "rack.input");
0
   DEF_GLOBAL(url_scheme, "rack.url_scheme");
0
   DEF_GLOBAL(url_scheme_value, "http");
0
   DEF_GLOBAL(script_name, "SCRIPT_NAME");

Comments

    No one has commented yet.