nutcracker 0.3.0.12 → 0.4.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +3 -3
  3. data/Rakefile +12 -10
  4. data/ext/nutcracker/Makefile.in +215 -162
  5. data/ext/nutcracker/README.md +16 -4
  6. data/ext/nutcracker/aclocal.m4 +432 -254
  7. data/ext/nutcracker/{contrib/yaml-0.1.4/configure → autom4te.cache/output.0} +11367 -4545
  8. data/ext/nutcracker/autom4te.cache/output.1 +19907 -0
  9. data/ext/nutcracker/autom4te.cache/output.2 +19907 -0
  10. data/ext/nutcracker/autom4te.cache/requests +518 -0
  11. data/ext/nutcracker/autom4te.cache/traces.0 +2715 -0
  12. data/ext/nutcracker/autom4te.cache/traces.1 +967 -0
  13. data/ext/nutcracker/autom4te.cache/traces.2 +2715 -0
  14. data/ext/nutcracker/config/compile +347 -0
  15. data/ext/nutcracker/config/config.guess +116 -78
  16. data/ext/nutcracker/config/config.sub +65 -45
  17. data/ext/nutcracker/config/depcomp +295 -192
  18. data/ext/nutcracker/config/install-sh +7 -7
  19. data/ext/nutcracker/config/ltmain.sh +15 -20
  20. data/ext/nutcracker/config/missing +149 -265
  21. data/ext/nutcracker/configure +493 -367
  22. data/ext/nutcracker/contrib/Makefile.in +158 -116
  23. data/ext/nutcracker/extconf.rb +0 -1
  24. data/ext/nutcracker/m4/libtool.m4 +4 -23
  25. data/ext/nutcracker/m4/ltoptions.m4 +0 -0
  26. data/ext/nutcracker/m4/ltsugar.m4 +0 -0
  27. data/ext/nutcracker/m4/ltversion.m4 +0 -0
  28. data/ext/nutcracker/m4/lt~obsolete.m4 +0 -0
  29. data/ext/nutcracker/notes/recommendation.md +1 -1
  30. data/ext/nutcracker/notes/redis.md +35 -3
  31. data/ext/nutcracker/scripts/benchmark-mget.py +43 -0
  32. data/ext/nutcracker/scripts/nutcracker.spec +61 -3
  33. data/ext/nutcracker/scripts/redis-check.sh +43 -0
  34. data/ext/nutcracker/src/Makefile.in +205 -142
  35. data/ext/nutcracker/src/event/Makefile.in +164 -66
  36. data/ext/nutcracker/src/hashkit/Makefile.in +164 -66
  37. data/ext/nutcracker/src/nc_conf.c +2 -0
  38. data/ext/nutcracker/src/nc_connection.c +31 -0
  39. data/ext/nutcracker/src/nc_connection.h +3 -0
  40. data/ext/nutcracker/src/nc_core.c +38 -2
  41. data/ext/nutcracker/src/nc_core.h +11 -0
  42. data/ext/nutcracker/src/nc_log.c +90 -12
  43. data/ext/nutcracker/src/nc_log.h +11 -0
  44. data/ext/nutcracker/src/nc_mbuf.h +1 -1
  45. data/ext/nutcracker/src/nc_message.c +162 -116
  46. data/ext/nutcracker/src/nc_message.h +161 -129
  47. data/ext/nutcracker/src/nc_proxy.c +34 -4
  48. data/ext/nutcracker/src/nc_request.c +158 -32
  49. data/ext/nutcracker/src/nc_server.c +59 -5
  50. data/ext/nutcracker/src/nc_server.h +1 -0
  51. data/ext/nutcracker/src/nc_signal.c +2 -2
  52. data/ext/nutcracker/src/nc_stats.c +21 -0
  53. data/ext/nutcracker/src/nc_stats.h +28 -26
  54. data/ext/nutcracker/src/nc_string.c +176 -1
  55. data/ext/nutcracker/src/nc_string.h +26 -0
  56. data/ext/nutcracker/src/nc_util.c +12 -0
  57. data/ext/nutcracker/src/nc_util.h +1 -0
  58. data/ext/nutcracker/src/proto/Makefile.in +164 -66
  59. data/ext/nutcracker/src/proto/nc_memcache.c +279 -88
  60. data/ext/nutcracker/src/proto/nc_proto.h +3 -4
  61. data/ext/nutcracker/src/proto/nc_redis.c +561 -134
  62. data/lib/nutcracker/version.rb +1 -1
  63. metadata +31 -67
  64. data/ext/nutcracker/contrib/yaml-0.1.4/LICENSE +0 -19
  65. data/ext/nutcracker/contrib/yaml-0.1.4/Makefile.am +0 -20
  66. data/ext/nutcracker/contrib/yaml-0.1.4/Makefile.in +0 -736
  67. data/ext/nutcracker/contrib/yaml-0.1.4/README +0 -27
  68. data/ext/nutcracker/contrib/yaml-0.1.4/aclocal.m4 +0 -956
  69. data/ext/nutcracker/contrib/yaml-0.1.4/config.h.in +0 -80
  70. data/ext/nutcracker/contrib/yaml-0.1.4/config/config.guess +0 -1561
  71. data/ext/nutcracker/contrib/yaml-0.1.4/config/config.sub +0 -1686
  72. data/ext/nutcracker/contrib/yaml-0.1.4/config/depcomp +0 -630
  73. data/ext/nutcracker/contrib/yaml-0.1.4/config/install-sh +0 -520
  74. data/ext/nutcracker/contrib/yaml-0.1.4/config/ltmain.sh +0 -8406
  75. data/ext/nutcracker/contrib/yaml-0.1.4/config/missing +0 -376
  76. data/ext/nutcracker/contrib/yaml-0.1.4/configure.ac +0 -75
  77. data/ext/nutcracker/contrib/yaml-0.1.4/doc/doxygen.cfg +0 -222
  78. data/ext/nutcracker/contrib/yaml-0.1.4/include/yaml.h +0 -1971
  79. data/ext/nutcracker/contrib/yaml-0.1.4/m4/libtool.m4 +0 -7357
  80. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltoptions.m4 +0 -368
  81. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltsugar.m4 +0 -123
  82. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltversion.m4 +0 -23
  83. data/ext/nutcracker/contrib/yaml-0.1.4/m4/lt~obsolete.m4 +0 -92
  84. data/ext/nutcracker/contrib/yaml-0.1.4/src/Makefile.am +0 -4
  85. data/ext/nutcracker/contrib/yaml-0.1.4/src/Makefile.in +0 -484
  86. data/ext/nutcracker/contrib/yaml-0.1.4/src/api.c +0 -1392
  87. data/ext/nutcracker/contrib/yaml-0.1.4/src/dumper.c +0 -394
  88. data/ext/nutcracker/contrib/yaml-0.1.4/src/emitter.c +0 -2329
  89. data/ext/nutcracker/contrib/yaml-0.1.4/src/loader.c +0 -432
  90. data/ext/nutcracker/contrib/yaml-0.1.4/src/parser.c +0 -1374
  91. data/ext/nutcracker/contrib/yaml-0.1.4/src/reader.c +0 -465
  92. data/ext/nutcracker/contrib/yaml-0.1.4/src/scanner.c +0 -3570
  93. data/ext/nutcracker/contrib/yaml-0.1.4/src/writer.c +0 -141
  94. data/ext/nutcracker/contrib/yaml-0.1.4/src/yaml_private.h +0 -640
  95. data/ext/nutcracker/contrib/yaml-0.1.4/tests/Makefile.am +0 -8
  96. data/ext/nutcracker/contrib/yaml-0.1.4/tests/Makefile.in +0 -675
  97. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor-alt.c +0 -800
  98. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor.c +0 -1130
  99. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter-alt.c +0 -217
  100. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter.c +0 -202
  101. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-dumper.c +0 -311
  102. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-emitter.c +0 -327
  103. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-loader.c +0 -63
  104. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-parser.c +0 -63
  105. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-scanner.c +0 -63
  106. data/ext/nutcracker/contrib/yaml-0.1.4/tests/test-reader.c +0 -354
  107. data/ext/nutcracker/contrib/yaml-0.1.4/tests/test-version.c +0 -29
@@ -1,327 +0,0 @@
1
- #include <yaml.h>
2
-
3
- #include <stdlib.h>
4
- #include <stdio.h>
5
- #include <string.h>
6
-
7
- #ifdef NDEBUG
8
- #undef NDEBUG
9
- #endif
10
- #include <assert.h>
11
-
12
- #define BUFFER_SIZE 65536
13
- #define MAX_EVENTS 1024
14
-
15
- int copy_event(yaml_event_t *event_to, yaml_event_t *event_from)
16
- {
17
- switch (event_from->type)
18
- {
19
- case YAML_STREAM_START_EVENT:
20
- return yaml_stream_start_event_initialize(event_to,
21
- event_from->data.stream_start.encoding);
22
-
23
- case YAML_STREAM_END_EVENT:
24
- return yaml_stream_end_event_initialize(event_to);
25
-
26
- case YAML_DOCUMENT_START_EVENT:
27
- return yaml_document_start_event_initialize(event_to,
28
- event_from->data.document_start.version_directive,
29
- event_from->data.document_start.tag_directives.start,
30
- event_from->data.document_start.tag_directives.end,
31
- event_from->data.document_start.implicit);
32
-
33
- case YAML_DOCUMENT_END_EVENT:
34
- return yaml_document_end_event_initialize(event_to,
35
- event_from->data.document_end.implicit);
36
-
37
- case YAML_ALIAS_EVENT:
38
- return yaml_alias_event_initialize(event_to,
39
- event_from->data.alias.anchor);
40
-
41
- case YAML_SCALAR_EVENT:
42
- return yaml_scalar_event_initialize(event_to,
43
- event_from->data.scalar.anchor,
44
- event_from->data.scalar.tag,
45
- event_from->data.scalar.value,
46
- event_from->data.scalar.length,
47
- event_from->data.scalar.plain_implicit,
48
- event_from->data.scalar.quoted_implicit,
49
- event_from->data.scalar.style);
50
-
51
- case YAML_SEQUENCE_START_EVENT:
52
- return yaml_sequence_start_event_initialize(event_to,
53
- event_from->data.sequence_start.anchor,
54
- event_from->data.sequence_start.tag,
55
- event_from->data.sequence_start.implicit,
56
- event_from->data.sequence_start.style);
57
-
58
- case YAML_SEQUENCE_END_EVENT:
59
- return yaml_sequence_end_event_initialize(event_to);
60
-
61
- case YAML_MAPPING_START_EVENT:
62
- return yaml_mapping_start_event_initialize(event_to,
63
- event_from->data.mapping_start.anchor,
64
- event_from->data.mapping_start.tag,
65
- event_from->data.mapping_start.implicit,
66
- event_from->data.mapping_start.style);
67
-
68
- case YAML_MAPPING_END_EVENT:
69
- return yaml_mapping_end_event_initialize(event_to);
70
-
71
- default:
72
- assert(1);
73
- }
74
-
75
- return 0;
76
- }
77
-
78
- int compare_events(yaml_event_t *event1, yaml_event_t *event2)
79
- {
80
- int k;
81
-
82
- if (event1->type != event2->type)
83
- return 0;
84
-
85
- switch (event1->type)
86
- {
87
- case YAML_STREAM_START_EVENT:
88
- return 1;
89
- /* return (event1->data.stream_start.encoding ==
90
- event2->data.stream_start.encoding); */
91
-
92
- case YAML_DOCUMENT_START_EVENT:
93
- if ((event1->data.document_start.version_directive && !event2->data.document_start.version_directive)
94
- || (!event1->data.document_start.version_directive && event2->data.document_start.version_directive)
95
- || (event1->data.document_start.version_directive && event2->data.document_start.version_directive
96
- && (event1->data.document_start.version_directive->major != event2->data.document_start.version_directive->major
97
- || event1->data.document_start.version_directive->minor != event2->data.document_start.version_directive->minor)))
98
- return 0;
99
- if ((event1->data.document_start.tag_directives.end - event1->data.document_start.tag_directives.start) !=
100
- (event2->data.document_start.tag_directives.end - event2->data.document_start.tag_directives.start))
101
- return 0;
102
- for (k = 0; k < (event1->data.document_start.tag_directives.end - event1->data.document_start.tag_directives.start); k ++) {
103
- if ((strcmp((char *)event1->data.document_start.tag_directives.start[k].handle,
104
- (char *)event2->data.document_start.tag_directives.start[k].handle) != 0)
105
- || (strcmp((char *)event1->data.document_start.tag_directives.start[k].prefix,
106
- (char *)event2->data.document_start.tag_directives.start[k].prefix) != 0))
107
- return 0;
108
- }
109
- /* if (event1->data.document_start.implicit != event2->data.document_start.implicit)
110
- return 0; */
111
- return 1;
112
-
113
- case YAML_DOCUMENT_END_EVENT:
114
- return 1;
115
- /* return (event1->data.document_end.implicit ==
116
- event2->data.document_end.implicit); */
117
-
118
- case YAML_ALIAS_EVENT:
119
- return (strcmp((char *)event1->data.alias.anchor,
120
- (char *)event2->data.alias.anchor) == 0);
121
-
122
- case YAML_SCALAR_EVENT:
123
- if ((event1->data.scalar.anchor && !event2->data.scalar.anchor)
124
- || (!event1->data.scalar.anchor && event2->data.scalar.anchor)
125
- || (event1->data.scalar.anchor && event2->data.scalar.anchor
126
- && strcmp((char *)event1->data.scalar.anchor,
127
- (char *)event2->data.scalar.anchor) != 0))
128
- return 0;
129
- if ((event1->data.scalar.tag && !event2->data.scalar.tag
130
- && strcmp((char *)event1->data.scalar.tag, "!") != 0)
131
- || (!event1->data.scalar.tag && event2->data.scalar.tag
132
- && strcmp((char *)event2->data.scalar.tag, "!") != 0)
133
- || (event1->data.scalar.tag && event2->data.scalar.tag
134
- && strcmp((char *)event1->data.scalar.tag,
135
- (char *)event2->data.scalar.tag) != 0))
136
- return 0;
137
- if ((event1->data.scalar.length != event2->data.scalar.length)
138
- || memcmp(event1->data.scalar.value, event2->data.scalar.value,
139
- event1->data.scalar.length) != 0)
140
- return 0;
141
- if ((event1->data.scalar.plain_implicit != event2->data.scalar.plain_implicit)
142
- || (event2->data.scalar.quoted_implicit != event2->data.scalar.quoted_implicit)
143
- /* || (event2->data.scalar.style != event2->data.scalar.style) */)
144
- return 0;
145
- return 1;
146
-
147
- case YAML_SEQUENCE_START_EVENT:
148
- if ((event1->data.sequence_start.anchor && !event2->data.sequence_start.anchor)
149
- || (!event1->data.sequence_start.anchor && event2->data.sequence_start.anchor)
150
- || (event1->data.sequence_start.anchor && event2->data.sequence_start.anchor
151
- && strcmp((char *)event1->data.sequence_start.anchor,
152
- (char *)event2->data.sequence_start.anchor) != 0))
153
- return 0;
154
- if ((event1->data.sequence_start.tag && !event2->data.sequence_start.tag)
155
- || (!event1->data.sequence_start.tag && event2->data.sequence_start.tag)
156
- || (event1->data.sequence_start.tag && event2->data.sequence_start.tag
157
- && strcmp((char *)event1->data.sequence_start.tag,
158
- (char *)event2->data.sequence_start.tag) != 0))
159
- return 0;
160
- if ((event1->data.sequence_start.implicit != event2->data.sequence_start.implicit)
161
- /* || (event2->data.sequence_start.style != event2->data.sequence_start.style) */)
162
- return 0;
163
- return 1;
164
-
165
- case YAML_MAPPING_START_EVENT:
166
- if ((event1->data.mapping_start.anchor && !event2->data.mapping_start.anchor)
167
- || (!event1->data.mapping_start.anchor && event2->data.mapping_start.anchor)
168
- || (event1->data.mapping_start.anchor && event2->data.mapping_start.anchor
169
- && strcmp((char *)event1->data.mapping_start.anchor,
170
- (char *)event2->data.mapping_start.anchor) != 0))
171
- return 0;
172
- if ((event1->data.mapping_start.tag && !event2->data.mapping_start.tag)
173
- || (!event1->data.mapping_start.tag && event2->data.mapping_start.tag)
174
- || (event1->data.mapping_start.tag && event2->data.mapping_start.tag
175
- && strcmp((char *)event1->data.mapping_start.tag,
176
- (char *)event2->data.mapping_start.tag) != 0))
177
- return 0;
178
- if ((event1->data.mapping_start.implicit != event2->data.mapping_start.implicit)
179
- /* || (event2->data.mapping_start.style != event2->data.mapping_start.style) */)
180
- return 0;
181
- return 1;
182
-
183
- default:
184
- return 1;
185
- }
186
- }
187
-
188
- int print_output(char *name, unsigned char *buffer, size_t size, int count)
189
- {
190
- FILE *file;
191
- char data[BUFFER_SIZE];
192
- size_t data_size = 1;
193
- size_t total_size = 0;
194
- if (count >= 0) {
195
- printf("FAILED (at the event #%d)\nSOURCE:\n", count+1);
196
- }
197
- file = fopen(name, "rb");
198
- assert(file);
199
- while (data_size > 0) {
200
- data_size = fread(data, 1, BUFFER_SIZE, file);
201
- assert(!ferror(file));
202
- if (!data_size) break;
203
- assert(fwrite(data, 1, data_size, stdout) == data_size);
204
- total_size += data_size;
205
- if (feof(file)) break;
206
- }
207
- fclose(file);
208
- printf("#### (length: %d)\n", total_size);
209
- printf("OUTPUT:\n%s#### (length: %d)\n", buffer, size);
210
- return 0;
211
- }
212
-
213
- int
214
- main(int argc, char *argv[])
215
- {
216
- int number;
217
- int canonical = 0;
218
- int unicode = 0;
219
-
220
- number = 1;
221
- while (number < argc) {
222
- if (strcmp(argv[number], "-c") == 0) {
223
- canonical = 1;
224
- }
225
- else if (strcmp(argv[number], "-u") == 0) {
226
- unicode = 1;
227
- }
228
- else if (argv[number][0] == '-') {
229
- printf("Unknown option: '%s'\n", argv[number]);
230
- return 0;
231
- }
232
- if (argv[number][0] == '-') {
233
- if (number < argc-1) {
234
- memmove(argv+number, argv+number+1, (argc-number-1)*sizeof(char *));
235
- }
236
- argc --;
237
- }
238
- else {
239
- number ++;
240
- }
241
- }
242
-
243
- if (argc < 2) {
244
- printf("Usage: %s [-c] [-u] file1.yaml ...\n", argv[0]);
245
- return 0;
246
- }
247
-
248
- for (number = 1; number < argc; number ++)
249
- {
250
- FILE *file;
251
- yaml_parser_t parser;
252
- yaml_emitter_t emitter;
253
- yaml_event_t event;
254
- unsigned char buffer[BUFFER_SIZE];
255
- size_t written = 0;
256
- yaml_event_t events[MAX_EVENTS];
257
- size_t event_number = 0;
258
- int done = 0;
259
- int count = 0;
260
- int error = 0;
261
- int k;
262
- memset(buffer, 0, BUFFER_SIZE);
263
- memset(events, 0, MAX_EVENTS*sizeof(yaml_event_t));
264
-
265
- printf("[%d] Parsing, emitting, and parsing again '%s': ", number, argv[number]);
266
- fflush(stdout);
267
-
268
- file = fopen(argv[number], "rb");
269
- assert(file);
270
-
271
- assert(yaml_parser_initialize(&parser));
272
- yaml_parser_set_input_file(&parser, file);
273
- assert(yaml_emitter_initialize(&emitter));
274
- if (canonical) {
275
- yaml_emitter_set_canonical(&emitter, 1);
276
- }
277
- if (unicode) {
278
- yaml_emitter_set_unicode(&emitter, 1);
279
- }
280
- yaml_emitter_set_output_string(&emitter, buffer, BUFFER_SIZE, &written);
281
-
282
- while (!done)
283
- {
284
- if (!yaml_parser_parse(&parser, &event)) {
285
- error = 1;
286
- break;
287
- }
288
-
289
- done = (event.type == YAML_STREAM_END_EVENT);
290
- assert(event_number < MAX_EVENTS);
291
- assert(copy_event(&(events[event_number++]), &event));
292
- assert(yaml_emitter_emit(&emitter, &event) ||
293
- (yaml_emitter_flush(&emitter) && print_output(argv[number], buffer, written, count)));
294
- count ++;
295
- }
296
-
297
- yaml_parser_delete(&parser);
298
- assert(!fclose(file));
299
- yaml_emitter_delete(&emitter);
300
-
301
- if (!error)
302
- {
303
- count = done = 0;
304
- assert(yaml_parser_initialize(&parser));
305
- yaml_parser_set_input_string(&parser, buffer, written);
306
-
307
- while (!done)
308
- {
309
- assert(yaml_parser_parse(&parser, &event) || print_output(argv[number], buffer, written, count));
310
- done = (event.type == YAML_STREAM_END_EVENT);
311
- assert(compare_events(events+count, &event) || print_output(argv[number], buffer, written, count));
312
- yaml_event_delete(&event);
313
- count ++;
314
- }
315
- yaml_parser_delete(&parser);
316
- }
317
-
318
- for (k = 0; k < event_number; k ++) {
319
- yaml_event_delete(events+k);
320
- }
321
-
322
- printf("PASSED (length: %d)\n", written);
323
- print_output(argv[number], buffer, written, -1);
324
- }
325
-
326
- return 0;
327
- }
@@ -1,63 +0,0 @@
1
- #include <yaml.h>
2
-
3
- #include <stdlib.h>
4
- #include <stdio.h>
5
-
6
- #ifdef NDEBUG
7
- #undef NDEBUG
8
- #endif
9
- #include <assert.h>
10
-
11
- int
12
- main(int argc, char *argv[])
13
- {
14
- int number;
15
-
16
- if (argc < 2) {
17
- printf("Usage: %s file1.yaml ...\n", argv[0]);
18
- return 0;
19
- }
20
-
21
- for (number = 1; number < argc; number ++)
22
- {
23
- FILE *file;
24
- yaml_parser_t parser;
25
- yaml_document_t document;
26
- int done = 0;
27
- int count = 0;
28
- int error = 0;
29
-
30
- printf("[%d] Loading '%s': ", number, argv[number]);
31
- fflush(stdout);
32
-
33
- file = fopen(argv[number], "rb");
34
- assert(file);
35
-
36
- assert(yaml_parser_initialize(&parser));
37
-
38
- yaml_parser_set_input_file(&parser, file);
39
-
40
- while (!done)
41
- {
42
- if (!yaml_parser_load(&parser, &document)) {
43
- error = 1;
44
- break;
45
- }
46
-
47
- done = (!yaml_document_get_root_node(&document));
48
-
49
- yaml_document_delete(&document);
50
-
51
- if (!done) count ++;
52
- }
53
-
54
- yaml_parser_delete(&parser);
55
-
56
- assert(!fclose(file));
57
-
58
- printf("%s (%d documents)\n", (error ? "FAILURE" : "SUCCESS"), count);
59
- }
60
-
61
- return 0;
62
- }
63
-
@@ -1,63 +0,0 @@
1
- #include <yaml.h>
2
-
3
- #include <stdlib.h>
4
- #include <stdio.h>
5
-
6
- #ifdef NDEBUG
7
- #undef NDEBUG
8
- #endif
9
- #include <assert.h>
10
-
11
- int
12
- main(int argc, char *argv[])
13
- {
14
- int number;
15
-
16
- if (argc < 2) {
17
- printf("Usage: %s file1.yaml ...\n", argv[0]);
18
- return 0;
19
- }
20
-
21
- for (number = 1; number < argc; number ++)
22
- {
23
- FILE *file;
24
- yaml_parser_t parser;
25
- yaml_event_t event;
26
- int done = 0;
27
- int count = 0;
28
- int error = 0;
29
-
30
- printf("[%d] Parsing '%s': ", number, argv[number]);
31
- fflush(stdout);
32
-
33
- file = fopen(argv[number], "rb");
34
- assert(file);
35
-
36
- assert(yaml_parser_initialize(&parser));
37
-
38
- yaml_parser_set_input_file(&parser, file);
39
-
40
- while (!done)
41
- {
42
- if (!yaml_parser_parse(&parser, &event)) {
43
- error = 1;
44
- break;
45
- }
46
-
47
- done = (event.type == YAML_STREAM_END_EVENT);
48
-
49
- yaml_event_delete(&event);
50
-
51
- count ++;
52
- }
53
-
54
- yaml_parser_delete(&parser);
55
-
56
- assert(!fclose(file));
57
-
58
- printf("%s (%d events)\n", (error ? "FAILURE" : "SUCCESS"), count);
59
- }
60
-
61
- return 0;
62
- }
63
-