MCPcopy Create free account
hub / github.com/Kitware/CMake / yy_scan_bytes

Function yy_scan_bytes

Source/LexerParser/cmListFileLexer.c:2178–2206  ·  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. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */

Source from the content-addressed store, hash-verified

2176 * @return the newly allocated buffer state object.
2177 */
2178YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2179{
2180 YY_BUFFER_STATE b;
2181 char *buf;
2182 yy_size_t n;
2183 int i;
2184
2185 /* Get memory for full buffer, including space for trailing EOB's. */
2186 n = (yy_size_t) (_yybytes_len + 2);
2187 buf = (char *) yyalloc( n , yyscanner );
2188 if ( ! buf )
2189 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2190
2191 for ( i = 0; i < _yybytes_len; ++i )
2192 buf[i] = yybytes[i];
2193
2194 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2195
2196 b = yy_scan_buffer( buf, n , yyscanner);
2197 if ( ! b )
2198 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2199
2200 /* It's okay to grow etc. this buffer, and we should throw it
2201 * away when we're done.
2202 */
2203 b->yy_is_our_buffer = 1;
2204
2205 return b;
2206}
2207
2208#ifndef YY_EXIT_FAILURE
2209#define YY_EXIT_FAILURE 2

Callers 1

yy_scan_stringFunction · 0.70

Calls 2

yyallocFunction · 0.70
yy_scan_bufferFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…