summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/dbestfit-3.3/mytest.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-05-22 21:58:48 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-05-22 21:58:48 +0000
commit513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch)
tree10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/dbestfit-3.3/mytest.c
parent95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff)
downloadrockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz
rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/dbestfit-3.3/mytest.c')
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/mytest.c140
1 files changed, 140 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/dbestfit-3.3/mytest.c b/apps/plugins/pdbox/dbestfit-3.3/mytest.c
new file mode 100644
index 0000000000..bf338b72ef
--- /dev/null
+++ b/apps/plugins/pdbox/dbestfit-3.3/mytest.c
@@ -0,0 +1,140 @@
1
2#include <stdio.h>
3#include <stdlib.h>
4
5#include "bmalloc.h"
6
7int main(int argc, char **argv)
8{
9 void *pointers[5];
10 int i;
11 void *area;
12
13 for(i=0; i<5; i++)
14 pointers[i] = malloc(8000);
15
16 if(argc>1) {
17 switch(argv[1][0]) {
18 case '1':
19 for(i=0; i<5; i++) {
20 add_pool(pointers[i], 4000);
21 add_pool((char *)pointers[i]+4000, 4000);
22 }
23 break;
24 case '2':
25 area = malloc(20000);
26 add_pool(area, 3000);
27 add_pool((char *)area+6000, 3000);
28 add_pool((char *)area+3000, 3000);
29 add_pool((char *)area+12000, 3000);
30 add_pool((char *)area+9000, 3000);
31 break;
32 case '3':
33 {
34 void *ptr[10];
35 area = malloc(20000);
36 add_pool(area, 20000);
37
38 printf(" ** TEST USAGE\n");
39 for(i=0; i<9; i++)
40 ptr[i]=bmalloc(200);
41 print_lists();
42 for(i=0; i<9; i++)
43 bfree(ptr[i]);
44 printf(" ** END OF TEST USAGE\n");
45 }
46
47 break;
48 case '4':
49 {
50 void *ptr[10];
51 area = malloc(20000);
52 add_pool(area, 20000);
53
54 ptr[0]=bmalloc(4080);
55 print_lists();
56 bfree(ptr[0]);
57 printf(" ** END OF TEST USAGE\n");
58 }
59
60 break;
61 }
62 }
63 else
64 for(i=4; i>=0; i--)
65 add_pool(pointers[i], 8000-i*100);
66
67 print_lists();
68
69 return 0;
70}
71
72#include <stdio.h>
73#include <stdlib.h>
74
75#include "bmalloc.h"
76
77int main(int argc, char **argv)
78{
79 void *pointers[5];
80 int i;
81 void *area;
82
83 for(i=0; i<5; i++)
84 pointers[i] = malloc(8000);
85
86 if(argc>1) {
87 switch(argv[1][0]) {
88 case '1':
89 for(i=0; i<5; i++) {
90 add_pool(pointers[i], 4000);
91 add_pool((char *)pointers[i]+4000, 4000);
92 }
93 break;
94 case '2':
95 area = malloc(20000);
96 add_pool(area, 3000);
97 add_pool((char *)area+6000, 3000);
98 add_pool((char *)area+3000, 3000);
99 add_pool((char *)area+12000, 3000);
100 add_pool((char *)area+9000, 3000);
101 break;
102 case '3':
103 {
104 void *ptr[10];
105 area = malloc(20000);
106 add_pool(area, 20000);
107
108 printf(" ** TEST USAGE\n");
109 for(i=0; i<9; i++)
110 ptr[i]=bmalloc(200);
111 print_lists();
112 for(i=0; i<9; i++)
113 bfree(ptr[i]);
114 printf(" ** END OF TEST USAGE\n");
115 }
116
117 break;
118 case '4':
119 {
120 void *ptr[10];
121 area = malloc(20000);
122 add_pool(area, 20000);
123
124 ptr[0]=bmalloc(4080);
125 print_lists();
126 bfree(ptr[0]);
127 printf(" ** END OF TEST USAGE\n");
128 }
129
130 break;
131 }
132 }
133 else
134 for(i=4; i>=0; i--)
135 add_pool(pointers[i], 8000-i*100);
136
137 print_lists();
138
139 return 0;
140}