ennaf/src/process.c
static inline unsigned in_get_until_specific_char(const unsigned char delim, string_t *str)
{
    unsigned d = INEOF;
    for (;;)
    {
        if (in_begin >= in_end)
        {
            refill_in_buffer();
            if (in_end == 0) { break; }
        }

        size_t i;
        for (i = in_begin; i < in_end; i++)
        {
            if (in_buffer[i] == delim) { d = delim; break; }
        }

        size_t s = i - in_begin;

        if (str->length + s >= UNCOMPRESSED_BUFFER_SIZE)
        {
            size_t s1 = UNCOMPRESSED_BUFFER_SIZE - str->length;
            size_t s2 = s - s1;
            memcpy(str->data + str->length, in_buffer + in_begin, s1);
            str->writer(str->data, UNCOMPRESSED_BUFFER_SIZE);
            memcpy(str->data, in_buffer + in_begin + s1, s2); 
            str->length = s2;
        }
        else
        {
            memcpy(str->data + str->length, in_buffer + in_begin, s);
            str->length += s;
        }

        in_begin = i + 1;

        if (d != INEOF) { break; }
    }

    return d;
}
/*
 * Reads input until a specific delimiter character is found.
 * Stores text until delimiter into 'str' (not including delimiter).
 * Returns delimiter, or INEOF at end of input.
 * Does NOT zero-terminate the text stored in 'str'.
 * Whenever 'str' fills, writes it out.
 */
Reads input until a specific delimiter character is found.
Stores text until delimiter into 'str' (not including delimiter).
Returns delimiter, or INEOF at end of input.
Does NOT zero-terminate the text stored in 'str'.
Whenever 'str' fills, writes it out.
Reads input until a specific delimiter character is found . Stores text until delimiter into ' str ' ( not including delimiter ) . Returns delimiter or INEOF at end of input . Does NOT zero - terminate the text stored in ' str ' . Whenever ' str ' fills writes it out .
static inline unsigned in_get_until_specific_char(const unsigned char delim, string_t *str)
{
    unsigned d = INEOF;
    for (;;)
    {
        if (in_begin >= in_end)
        {
            refill_in_buffer();
            if (in_end == 0) { break; }
        }
        size_t i;
        for (i = in_begin; i < in_end; i++)
        {
            if (in_buffer[i] == delim) { d = delim; break; }
        }
        size_t s = i - in_begin;
        if (str->length + s >= UNCOMPRESSED_BUFFER_SIZE)
        {
            size_t s1 = UNCOMPRESSED_BUFFER_SIZE - str->length;
            size_t s2 = s - s1;
            memcpy(str->data + str->length, in_buffer + in_begin, s1);
            str->writer(str->data, UNCOMPRESSED_BUFFER_SIZE);
            memcpy(str->data, in_buffer + in_begin + s1, s2); 
            str->length = s2;
        }
        else
        {
            memcpy(str->data + str->length, in_buffer + in_begin, s);
            str->length += s;
        }
        in_begin = i + 1;
        if (d != INEOF) { break; }
    }
    return d;
}
static inline unsigned in_get_until_specific_char ( const unsigned char delim , string_t * str ) { unsigned d = INEOF ; for ( ; ; ) { if ( in_begin >= in_end ) { refill_in_buffer ( ) ; if ( in_end == 0 ) { break ; } } size_t i ; for ( i = in_begin ; i < in_end ; i ++ ) { if ( in_buffer [ i ] == delim ) { d = delim ; break ; } } size_t s = i - in_begin ; if ( str -> length + s >= UNCOMPRESSED_BUFFER_SIZE ) { size_t s1 = UNCOMPRESSED_BUFFER_SIZE - str -> length ; size_t s2 = s - s1 ; memcpy ( str -> data + str -> length , in_buffer + in_begin , s1 ) ; str -> writer ( str -> data , UNCOMPRESSED_BUFFER_SIZE ) ; memcpy ( str -> data , in_buffer + in_begin + s1 , s2 ) ; str -> length = s2 ; } else { memcpy ( str -> data + str -> length , in_buffer + in_begin , s ) ; str -> length += s ; } in_begin = i + 1 ; if ( d != INEOF ) { break ; } } return d ; }
Reads input until a specific delimiter character is found.
Reads input until a specific delimiter character is found .