File: stdout_not_stderr.patch

package info (click to toggle)
cmph 2.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,748 kB
  • sloc: ansic: 10,582; cpp: 2,429; makefile: 151; sh: 111; python: 48; xml: 5
file content (303 lines) | stat: -rw-r--r-- 9,454 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
Description: Avoid writing information messages to stderr once the binary is built.
Author: Joseph Herlant<aerostitch@debian.org>
Forwarded: https://sourceforge.net/p/cmph/git/merge-requests/7/
Last-Update: 2018-10-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/tests/packed_mphf_tests.c
+++ b/tests/packed_mphf_tests.c
@@ -144,7 +144,7 @@
 	// packing the function
 	/* Determine how much space is needed to pack the mphf. */
 	cmph_uint32 packed_size = cmph_packed_size(mphf); 
-	fprintf(stderr, "packed_size = %u\n", packed_size);
+	fprintf(stdout, "packed_size = %u\n", packed_size);
 	
 	/* Make sure that we have enough space to pack the mphf. */
 	cmph_uint8 * packed_mphf = (cmph_uint8 *)calloc((size_t)packed_size,(size_t)1);
--- a/tests/compressed_rank_tests.c
+++ b/tests/compressed_rank_tests.c
@@ -9,7 +9,7 @@
 	register cmph_uint32 index;
 	
 	index = compressed_rank_query(cr, idx);
-	fprintf(stderr, "Index[%u]\t= %u\n", idx, index);
+	fprintf(stdout, "Index[%u]\t= %u\n", idx, index);
 }
 
 
@@ -18,7 +18,7 @@
 	register cmph_uint32 index;
 	
 	index = compressed_rank_query_packed(cr_packed, idx);
-	fprintf(stderr, "Index[%u]\t= %u\n", idx, index);
+	fprintf(stdout, "Index[%u]\t= %u\n", idx, index);
 }
 
 /*
@@ -42,17 +42,17 @@
 	
 	compressed_rank_init(&cr);
 	compressed_rank_generate(&cr, keys_vec, n);
-	fprintf(stderr, "Space usage = %u\n", compressed_rank_get_space_usage(&cr));
+	fprintf(stdout, "Space usage = %u\n", compressed_rank_get_space_usage(&cr));
 	for(i = 0; i < nIndices; i++)
 	{
 		print_values(&cr, i);
 	}
 	
-	fprintf(stderr, "Dumping compressed rank structure\n");
+	fprintf(stdout, "Dumping compressed rank structure\n");
 	compressed_rank_dump(&cr, &buf, &buflen);
 	
 	compressed_rank_destroy(&cr);
-	fprintf(stderr, "Loading compressed rank structure\n");
+	fprintf(stdout, "Loading compressed rank structure\n");
 	
 	compressed_rank_load(&cr, buf, buflen);
 	for(i = 0; i < nIndices; i++)
@@ -67,7 +67,7 @@
 	compressed_rank_pack(&cr, cr_packed);
 	compressed_rank_destroy(&cr);
 	
-	fprintf(stderr, "Querying the packed compressed rank structure\n");
+	fprintf(stdout, "Querying the packed compressed rank structure\n");
 	for(i = 0; i < nIndices; i++)
 	{
 		print_values_packed(cr_packed, i);
--- a/tests/compressed_seq_tests.c
+++ b/tests/compressed_seq_tests.c
@@ -9,7 +9,7 @@
 	register cmph_uint32 index;
 	
 	index = compressed_seq_query(cs, idx);
-	fprintf(stderr, "Index[%u]\t= %u\n", idx, index);
+	fprintf(stdout, "Index[%u]\t= %u\n", idx, index);
 }
 
 
@@ -18,7 +18,7 @@
 	register cmph_uint32 index;
 	
 	index = compressed_seq_query_packed(cs_packed, idx);
-	fprintf(stderr, "Index[%u]\t= %u\n", idx, index);
+	fprintf(stdout, "Index[%u]\t= %u\n", idx, index);
 }
 
 int main(int argc, char **argv)
@@ -35,17 +35,17 @@
 	
 	compressed_seq_init(&cs);
 	compressed_seq_generate(&cs, keys_vec, n);
-	fprintf(stderr, "Space usage = %u\n", compressed_seq_get_space_usage(&cs));
+	fprintf(stdout, "Space usage = %u\n", compressed_seq_get_space_usage(&cs));
 	for(i = 0; i < n; i++)
 	{
 		print_values(&cs, i);
 	}
 	
-	fprintf(stderr, "Dumping compressed seq structure\n");
+	fprintf(stdout, "Dumping compressed seq structure\n");
 	compressed_seq_dump(&cs, &buf, &buflen);
 	
 	compressed_seq_destroy(&cs);
-	fprintf(stderr, "Loading compressed seq structure\n");
+	fprintf(stdout, "Loading compressed seq structure\n");
 	
 	compressed_seq_load(&cs, buf, buflen);
 	for(i = 0; i < n; i++)
@@ -60,7 +60,7 @@
 	compressed_seq_pack(&cs, cs_packed);
 	compressed_seq_destroy(&cs);
 	
-	fprintf(stderr, "Querying the packed compressed seq structure\n");
+	fprintf(stdout, "Querying the packed compressed seq structure\n");
 	for(i = 0; i < n; i++)
 	{
 		print_values_packed(cs_packed, i);
--- a/tests/select_tests.c
+++ b/tests/select_tests.c
@@ -9,25 +9,25 @@
 	register cmph_uint32 index;
 	
 	index = select_query(sel, 0);
-	fprintf(stderr, "Index[0]\t= %u\n", index - 0);
+	fprintf(stdout, "Index[0]\t= %u\n", index - 0);
 
 	index = select_next_query(sel, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query(sel, 1);
-	fprintf(stderr, "Index[1]\t= %u\n", index - 1);
+	fprintf(stdout, "Index[1]\t= %u\n", index - 1);
 
 	index = select_next_query(sel, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query(sel, 2);
-	fprintf(stderr, "Index[2]\t= %u\n", index - 2);
+	fprintf(stdout, "Index[2]\t= %u\n", index - 2);
 
 	index = select_next_query(sel, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query(sel, 3);
-	fprintf(stderr, "Index[3]\t= %u\n", index - 3);
+	fprintf(stdout, "Index[3]\t= %u\n", index - 3);
 }
 
 
@@ -36,25 +36,25 @@
 	register cmph_uint32 index;
 	
 	index = select_query_packed(sel_packed, 0);
-	fprintf(stderr, "Index[0]\t= %u\n", index - 0);
+	fprintf(stdout, "Index[0]\t= %u\n", index - 0);
 
 	index = select_next_query_packed(sel_packed, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query_packed(sel_packed, 1);
-	fprintf(stderr, "Index[1]\t= %u\n", index - 1);
+	fprintf(stdout, "Index[1]\t= %u\n", index - 1);
 
 	index = select_next_query_packed(sel_packed, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query_packed(sel_packed, 2);
-	fprintf(stderr, "Index[2]\t= %u\n", index - 2);
+	fprintf(stdout, "Index[2]\t= %u\n", index - 2);
 
 	index = select_next_query_packed(sel_packed, index);
-	fprintf(stderr, "Next Index\t= %u\n", index);
+	fprintf(stdout, "Next Index\t= %u\n", index);
 
 	index = select_query_packed(sel_packed, 3);
-	fprintf(stderr, "Index[3]\t= %u\n", index - 3);
+	fprintf(stdout, "Index[3]\t= %u\n", index - 3);
 }
 
 int main(int argc, char **argv)
@@ -70,14 +70,14 @@
 	
 	select_init(&sel);
 	select_generate(&sel, keys_vec, n, m);
-	fprintf(stderr, "Space usage = %u\n", select_get_space_usage(&sel));
+	fprintf(stdout, "Space usage = %u\n", select_get_space_usage(&sel));
 	print_values(&sel);
 	
-	fprintf(stderr, "Dumping select structure\n");
+	fprintf(stdout, "Dumping select structure\n");
 	select_dump(&sel, &buf, &buflen);
 	
 	select_destroy(&sel);
-	fprintf(stderr, "Loading select structure\n");
+	fprintf(stdout, "Loading select structure\n");
 	
 	select_load(&sel, buf, buflen);
 	print_values(&sel);
@@ -89,7 +89,7 @@
 	select_pack(&sel, select_packed);
 	select_destroy(&sel);
 	
-	fprintf(stderr, "Querying the packed select structure\n");
+	fprintf(stdout, "Querying the packed select structure\n");
 	print_values_packed(select_packed);
 	
 	free(select_packed);
--- a/src/debug.h
+++ b/src/debug.h
@@ -29,7 +29,7 @@
 	if (!f) return;
 	memcpy(f, p, plen);
 	memcpy(f + plen, format, strlen(format) + 1);
-    vfprintf(stderr, f, ap);
+    vfprintf(stdout, f, ap);
     va_end(ap);
 	free(f);
 }
@@ -42,7 +42,7 @@
 #ifndef __GNUC__
 #define DEBUGP debugprintf
 #else
-#define DEBUGP(args...) do { fprintf(stderr, "%s:%d ", __FILE__, __LINE__); fprintf(stderr, ## args); } while(0)
+#define DEBUGP(args...) do { fprintf(stdout, "%s:%d ", __FILE__, __LINE__); fprintf(stdout, ## args); } while(0)
 #endif
 #else
 #ifndef __GNUC__
--- a/tests/graph_tests.c
+++ b/tests/graph_tests.c
@@ -9,7 +9,7 @@
 	cmph_uint32 i, neighbor;
 	graph_t *g = graph_new(5, 10);
 
-	fprintf(stderr, "Building random graph\n");
+	fprintf(stdout, "Building random graph\n");
 	for (i = 0; i < 10; ++i)
 	{
 		cmph_uint32 v1 = i % 5;
@@ -25,7 +25,7 @@
 	graph_print(g);
 	graph_destroy(g);
 
-	fprintf(stderr, "Building cyclic graph\n");
+	fprintf(stdout, "Building cyclic graph\n");
 	g = graph_new(4, 5);
 	graph_add_edge(g, 0, 3);
 	graph_add_edge(g, 0, 1);
@@ -37,7 +37,7 @@
 	}
 	graph_destroy(g);
 
-	fprintf(stderr, "Building non-cyclic graph\n");
+	fprintf(stdout, "Building non-cyclic graph\n");
 	g = graph_new(5, 4);
 	graph_add_edge(g, 0, 1);
 	graph_add_edge(g, 1, 2);
@@ -49,7 +49,7 @@
 		return 1;
 	}
 
-	fprintf(stderr, "Checking neighbors iterator\n");
+	fprintf(stdout, "Checking neighbors iterator\n");
 	it = graph_neighbors_it(g, 1);
 	neighbor = graph_next_neighbor(g, &it);
 	DEBUGP("Neighbor is %u\n", neighbor);
--- a/examples/file_adapter_ex2.c
+++ b/examples/file_adapter_ex2.c
@@ -23,7 +23,7 @@
 	//Find key
 	const char *key = "jjjjjjjjjj";
 	unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
-	fprintf(stderr, "Id:%u\n", id);
+	fprintf(stdout, "Id:%u\n", id);
 	//Destroy hash
 	cmph_destroy(hash);
 	cmph_io_nlfile_adapter_destroy(source);   
--- a/examples/struct_vector_adapter_ex3.c
+++ b/examples/struct_vector_adapter_ex3.c
@@ -39,7 +39,7 @@
     while (i < nkeys) {
       const char *key = vector[i].key;
       unsigned int id = cmph_search(hash, key, 11);
-      fprintf(stderr, "key:%s -- hash:%u\n", key, id);
+      fprintf(stdout, "key:%s -- hash:%u\n", key, id);
       i++;
     }
     
--- a/examples/vector_adapter_ex1.c
+++ b/examples/vector_adapter_ex1.c
@@ -29,7 +29,7 @@
     while (i < nkeys) {
         const char *key = vector[i];
         unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
-        fprintf(stderr, "key:%s -- hash:%u\n", key, id);
+        fprintf(stdout, "key:%s -- hash:%u\n", key, id);
         i++;
     }