MCPcopy Create free account
hub / github.com/activeloopai/deeplake / yy_scan_bytes

Function yy_scan_bytes

cpp/3rd_party/sql-parser/src/parser/flex_lexer.cpp:4738–4766  ·  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

4736 * @return the newly allocated buffer state object.
4737 */
4738YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
4739{
4740 YY_BUFFER_STATE b;
4741 char *buf;
4742 yy_size_t n;
4743 int i;
4744
4745 /* Get memory for full buffer, including space for trailing EOB's. */
4746 n = (yy_size_t) (_yybytes_len + 2);
4747 buf = (char *) yyalloc( n , yyscanner );
4748 if ( ! buf )
4749 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
4750
4751 for ( i = 0; i < _yybytes_len; ++i )
4752 buf[i] = yybytes[i];
4753
4754 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
4755
4756 b = yy_scan_buffer( buf, n , yyscanner);
4757 if ( ! b )
4758 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
4759
4760 /* It's okay to grow etc. this buffer, and we should throw it
4761 * away when we're done.
4762 */
4763 b->yy_is_our_buffer = 1;
4764
4765 return b;
4766}
4767
4768#ifndef YY_EXIT_FAILURE
4769#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