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. */
| 3940 | * @return the allocated buffer state. |
| 3941 | */ |
| 3942 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
| 3943 | { |
| 3944 | YY_BUFFER_STATE b; |
| 3945 | |
| 3946 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 3947 | if ( ! b ) |
| 3948 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 3949 | |
| 3950 | b->yy_buf_size = size; |
| 3951 | |
| 3952 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 3953 | * we need to put in 2 end-of-buffer characters. |
| 3954 | */ |
| 3955 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
| 3956 | if ( ! b->yy_ch_buf ) |
| 3957 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 3958 | |
| 3959 | b->yy_is_our_buffer = 1; |
| 3960 | |
| 3961 | yy_init_buffer( b, file , yyscanner); |
| 3962 | |
| 3963 | return b; |
| 3964 | } |
| 3965 | |
| 3966 | /** Destroy the buffer. |
| 3967 | * @param b a buffer created with yy_create_buffer() |
no test coverage detected