MCPcopy Create free account
hub / github.com/Entware/Entware / yy_scan_bytes

Function yy_scan_bytes

scripts/config/lexer.lex.c:3705–3733  ·  view source on GitHub ↗

Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */

Source from the content-addressed store, hash-verified

3703 * @return the newly allocated buffer state object.
3704 */
3705YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
3706{
3707 YY_BUFFER_STATE b;
3708 char *buf;
3709 yy_size_t n;
3710 int i;
3711
3712 /* Get memory for full buffer, including space for trailing EOB's. */
3713 n = (yy_size_t) (_yybytes_len + 2);
3714 buf = (char *) yyalloc( n );
3715 if ( ! buf )
3716 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3717
3718 for ( i = 0; i < _yybytes_len; ++i )
3719 buf[i] = yybytes[i];
3720
3721 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3722
3723 b = yy_scan_buffer( buf, n );
3724 if ( ! b )
3725 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3726
3727 /* It's okay to grow etc. this buffer, and we should throw it
3728 * away when we're done.
3729 */
3730 b->yy_is_our_buffer = 1;
3731
3732 return b;
3733}
3734
3735#ifndef YY_EXIT_FAILURE
3736#define YY_EXIT_FAILURE 2

Callers 1

yy_scan_stringFunction · 0.85

Calls 2

yyallocFunction · 0.85
yy_scan_bufferFunction · 0.85

Tested by

no test coverage detected