public
Description: New and ultra-turbo-crazy-fast backend for Thin
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin-turbo.git
Fix a couple buffer_test failures
macournoyer (author)
Sat Apr 26 20:47:12 -0700 2008
commit  f9b793e44e042879c4636df031f9edbb80ebbc5e
tree    7031aac7969f136c50ae7e3eda1221f373563a28
parent  283ca929a6bebdf975fdda9291964a432af96f6d
...
16
17
18
19
20
21
 
22
23
 
 
 
 
 
24
25
26
...
16
17
18
 
 
 
19
20
21
22
23
24
25
26
27
28
29
0
@@ -16,11 +16,14 @@ ext_task :thin_backend
0
 ragel_task 'ext/thin_backend', 'parser.rl', 'parser.c'
0
 
0
 task :test do
0
- cd 'test' do
0
- sh 'make test'
0
- end
0
+ cd('test') { sh 'make test' }
0
 end
0
 
0
+task 'test:clean' do
0
+ cd('test') { sh 'make clean' }
0
+end
0
+task :clean => 'test:clean'
0
+
0
 Spec::Rake::SpecTask.new(:spec) do |t|
0
   t.spec_opts = %w(-fs -c)
0
   t.spec_files = FileList['spec/**/*_spec.rb']
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@ void buffer_init(buffer_t *buf)
0
 {
0
   buf->ptr = palloc(buffer_pool(), 1);
0
   buf->nalloc = 1;
0
- buf->salloc = 0;
0
+ buf->salloc = BUFFER_CHUNK_SIZE;
0
   buf->len = 0;
0
   buf->offset = 0;
0
   buf->file.fd = -1;
...
5
6
7
8
9
10
11
 
12
13
14
15
16
17
 
18
19
20
21
22
23
24
25
 
26
27
28
...
31
32
33
34
35
36
37
38
39
40
41
42
43
 
44
45
46
...
57
58
59
60
61
62
63
64
 
65
66
67
68
69
70
 
71
72
 
 
73
74
75
...
79
80
81
82
 
83
84
85
86
...
5
6
7
 
8
9
 
10
11
 
12
 
 
 
13
14
15
16
17
 
18
19
 
20
21
22
23
...
26
27
28
 
 
29
30
31
32
 
33
34
 
35
36
37
38
...
49
50
51
 
 
52
53
 
54
55
 
 
 
 
 
56
57
 
58
59
60
61
62
...
66
67
68
 
69
70
71
72
73
0
@@ -5,24 +5,19 @@ test_init();
0
 
0
 void test_buffer_init(void)
0
 {
0
- pool_t *p = pool_create(10, 512);
0
   buffer_t b;
0
   
0
- buffer_init(&b, p);
0
+ buffer_init(&b);
0
   
0
- assert_equal(p, b.pool);
0
   assert_equal(1, b.nalloc);
0
- assert_equal(512, b.salloc);
0
-
0
- pool_destroy(p);
0
+ assert_equal(BUFFER_CHUNK_SIZE, b.salloc);
0
 }
0
 
0
 void test_buffer_append(void)
0
 {
0
- pool_t *p = pool_create(10, 1024);
0
   buffer_t b;
0
   
0
- buffer_init(&b, p);
0
+ buffer_init(&b);
0
   
0
   buffer_append(&b, "hi", 2);
0
   assert_str_equal("hi", b.ptr);
0
@@ -31,16 +26,13 @@ void test_buffer_append(void)
0
   assert_str_equal("hi you", b.ptr);
0
   assert_equal(6, b.len);
0
   assert_equal(1, b.nalloc);
0
-
0
- pool_destroy(p);
0
 }
0
 
0
 void test_buffer_grow_and_append(void)
0
 {
0
- pool_t *p = pool_create(10, 2);
0
   buffer_t b;
0
   
0
- buffer_init(&b, p);
0
+ buffer_init(&b);
0
   
0
   buffer_append(&b, "hi", 2);
0
   assert_equal(1, b.nalloc);
0
@@ -57,19 +49,14 @@ void test_buffer_grow_and_append(void)
0
   assert_equal(8, b.salloc);
0
 
0
   assert_str_equal("hi you ! ", b.ptr);
0
-
0
- pool_destroy(p);
0
 }
0
 
0
-void test_buffer_free(void)
0
+void test_buffer_reset(void)
0
 {
0
- pool_t *p = pool_create(10, 2);
0
- buffer_t b;
0
-
0
- buffer_init(&b, p);
0
- buffer_free(&b);
0
+ buffer_t b;
0
   
0
- pool_destroy(p);
0
+ buffer_init(&b);
0
+ buffer_reset(&b);
0
 }
0
 
0
 int main(int argc, char const *argv[])
0
@@ -79,7 +66,7 @@ int main(int argc, char const *argv[])
0
   test_buffer_init();
0
   test_buffer_append();
0
   test_buffer_grow_and_append();
0
- test_buffer_free();
0
+ test_buffer_reset();
0
   
0
   test_end();
0
 }
0
\ No newline at end of file

Comments

    No one has commented yet.