MCPcopy Create free account
hub / github.com/amule-project/amule / yy_create_buffer

Function yy_create_buffer

src/Scanner.cpp:1531–1553  ·  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

1529 * @return the allocated buffer state.
1530 */
1531 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1532{
1533 YY_BUFFER_STATE b;
1534
1535 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1536 if ( ! b )
1537 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1538
1539 b->yy_buf_size = size;
1540
1541 /* yy_ch_buf has to be 2 characters longer than the size given because
1542 * we need to put in 2 end-of-buffer characters.
1543 */
1544 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1545 if ( ! b->yy_ch_buf )
1546 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1547
1548 b->yy_is_our_buffer = 1;
1549
1550 yy_init_buffer( b, file );
1551
1552 return b;
1553}
1554
1555/** Destroy the buffer.
1556 * @param b a buffer created with yy_create_buffer()

Callers 2

Scanner.cppFile · 0.70
yyrestartFunction · 0.70

Calls 1

yy_init_bufferFunction · 0.70

Tested by

no test coverage detected