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. */
| 1859 | * @return the allocated buffer state. |
| 1860 | */ |
| 1861 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
| 1862 | { |
| 1863 | YY_BUFFER_STATE b; |
| 1864 | |
| 1865 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 1866 | if ( ! b ) |
| 1867 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1868 | |
| 1869 | b->yy_buf_size = size; |
| 1870 | |
| 1871 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1872 | * we need to put in 2 end-of-buffer characters. |
| 1873 | */ |
| 1874 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
| 1875 | if ( ! b->yy_ch_buf ) |
| 1876 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1877 | |
| 1878 | b->yy_is_our_buffer = 1; |
| 1879 | |
| 1880 | yy_init_buffer( b, file , yyscanner); |
| 1881 | |
| 1882 | return b; |
| 1883 | } |
| 1884 | |
| 1885 | /** Destroy the buffer. |
| 1886 | * @param b a buffer created with yy_create_buffer() |
no test coverage detected