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. */
| 1918 | * @return the allocated buffer state. |
| 1919 | */ |
| 1920 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
| 1921 | { |
| 1922 | YY_BUFFER_STATE b; |
| 1923 | |
| 1924 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 1925 | if ( ! b ) |
| 1926 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1927 | |
| 1928 | b->yy_buf_size = size; |
| 1929 | |
| 1930 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1931 | * we need to put in 2 end-of-buffer characters. |
| 1932 | */ |
| 1933 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
| 1934 | if ( ! b->yy_ch_buf ) |
| 1935 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1936 | |
| 1937 | b->yy_is_our_buffer = 1; |
| 1938 | |
| 1939 | yy_init_buffer( b, file , yyscanner); |
| 1940 | |
| 1941 | return b; |
| 1942 | } |
| 1943 | |
| 1944 | /** Destroy the buffer. |
| 1945 | * @param b a buffer created with yy_create_buffer() |
no test coverage detected
searching dependent graphs…