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. * @param yyscanner The scanner object. * @return the allocated buffer state. */
| 4373 | * @return the allocated buffer state. |
| 4374 | */ |
| 4375 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
| 4376 | { |
| 4377 | YY_BUFFER_STATE b; |
| 4378 | |
| 4379 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 4380 | if ( ! b ) |
| 4381 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 4382 | |
| 4383 | b->yy_buf_size = size; |
| 4384 | |
| 4385 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 4386 | * we need to put in 2 end-of-buffer characters. |
| 4387 | */ |
| 4388 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
| 4389 | if ( ! b->yy_ch_buf ) |
| 4390 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 4391 | |
| 4392 | b->yy_is_our_buffer = 1; |
| 4393 | |
| 4394 | yy_init_buffer( b, file , yyscanner); |
| 4395 | |
| 4396 | return b; |
| 4397 | } |
| 4398 | |
| 4399 | /** Destroy the buffer. |
| 4400 | * @param b a buffer created with yy_create_buffer() |
no test coverage detected