MCPcopy Create free account
hub / github.com/Entware/Entware / yy_create_buffer

Function yy_create_buffer

scripts/config/lexer.lex.c:3453–3475  ·  view source on GitHub ↗

Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */

Source from the content-addressed store, hash-verified

3451 * @return the allocated buffer state.
3452 */
3453 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
3454{
3455 YY_BUFFER_STATE b;
3456
3457 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
3458 if ( ! b )
3459 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3460
3461 b->yy_buf_size = size;
3462
3463 /* yy_ch_buf has to be 2 characters longer than the size given because
3464 * we need to put in 2 end-of-buffer characters.
3465 */
3466 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
3467 if ( ! b->yy_ch_buf )
3468 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3469
3470 b->yy_is_our_buffer = 1;
3471
3472 yy_init_buffer( b, file );
3473
3474 return b;
3475}
3476
3477/** Destroy the buffer.
3478 * @param b a buffer created with yy_create_buffer()

Callers 3

lexer.lex.cFile · 0.85
yyrestartFunction · 0.85
__zconf_nextfileFunction · 0.85

Calls 2

yyallocFunction · 0.85
yy_init_bufferFunction · 0.85

Tested by

no test coverage detected