Source

libyaml / src / reader.c

Kirill Simonov f459cf2 



















































#define RAW_BUFFER_SIZE 16384
#define BUFFER_SIZE (RAW_BUFFER_SIZE*2) /* Should be enough for decoding 
                                           the whole raw buffer. */

/*
 * Ensure that the buffer contains at least length characters.
 * Return 1 on success, 0 on failure.
 */

int
yaml_parser_update_reader(yaml_parser_t *parser, size_t length)
{
    /* If the EOF flag is set, do nothing. */

    if (parser->eof)
        return 1;

    /* First, let us check that the buffers are allocated. */

    if (!parser->buffer) {
        parser->buffer = yaml_malloc(BUFFER_SIZE);
        if (!parser->buffer) {
            parser->error = YAML_MEMORY_ERROR;
            return 0;
        }
        parser->buffer_size = BUFFER_SIZE;
        parser->buffer_pointer = parser->buffer;
        parser->buffer_length = 0;
    }

    if (!parser->raw_buffer) {
        parser->raw_buffer = yaml_malloc(RAW_BUFFER_SIZE);
        if (!parser->raw_buffer) {
            parser->error = YAML_MEMORY_ERROR;
            return 0;
        }
        parser->raw_buffer_size = RAW_BUFFER_SIZE;
    }

    /* Next, determine the input encoding. */

    if (!parser->encoding) {
        if (!yaml_parser_determine_encoding(parser))
            return 0;
    }

    /* more... */

}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.