2 #define RAW_BUFFER_SIZE 16384
3 #define BUFFER_SIZE (RAW_BUFFER_SIZE*2) /* Should be enough for decoding
4 the whole raw buffer. */
7 * Ensure that the buffer contains at least length characters.
8 * Return 1 on success, 0 on failure.
12 yaml_parser_update_reader(yaml_parser_t *parser, size_t length)
14 /* If the EOF flag is set, do nothing. */
19 /* First, let us check that the buffers are allocated. */
21 if (!parser->buffer) {
22 parser->buffer = yaml_malloc(BUFFER_SIZE);
23 if (!parser->buffer) {
24 parser->error = YAML_MEMORY_ERROR;
27 parser->buffer_size = BUFFER_SIZE;
28 parser->buffer_pointer = parser->buffer;
29 parser->buffer_length = 0;
32 if (!parser->raw_buffer) {
33 parser->raw_buffer = yaml_malloc(RAW_BUFFER_SIZE);
34 if (!parser->raw_buffer) {
35 parser->error = YAML_MEMORY_ERROR;
38 parser->raw_buffer_size = RAW_BUFFER_SIZE;
41 /* Next, determine the input encoding. */
43 if (!parser->encoding) {
44 if (!yaml_parser_determine_encoding(parser))