MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / stuff_args

Function stuff_args

src/yvalve/array.cpp:569–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567
568
569static ISC_STATUS stuff_args(gen_t* gen, SSHORT count, ...)
570{
571/**************************************
572 *
573 * s t u f f
574 *
575 **************************************
576 *
577 * Functional description
578 * Stuff a SDL byte.
579 *
580 **************************************/
581 UCHAR c;
582 va_list ptr;
583
584 if (gen->gen_sdl + count >= gen->gen_end)
585 {
586 if (gen->gen_internal < 0) {
587 return error(gen->gen_status, Arg::Gds(isc_misc_interpreted) << Arg::Str("SDL buffer overflow"));
588 }
589
590 // The sdl buffer is too small. Allocate a larger one.
591
592 const SSHORT new_len = gen->gen_end - *gen->gen_sdl_ptr + 512 + count;
593 UCHAR* const new_sdl = (UCHAR*) gds__alloc(new_len);
594 if (!new_sdl)
595 {
596 return error(gen->gen_status, Arg::Gds(isc_misc_interpreted) << Arg::Str("SDL buffer overflow") <<
597 Arg::Gds(isc_virmemexh));
598 }
599
600 const SSHORT current_len = gen->gen_sdl - *gen->gen_sdl_ptr;
601 memcpy(new_sdl, *gen->gen_sdl_ptr, current_len);
602 if (gen->gen_internal++)
603 gds__free(*gen->gen_sdl_ptr);
604 gen->gen_sdl = new_sdl + current_len;
605 *gen->gen_sdl_ptr = new_sdl;
606 gen->gen_end = new_sdl + new_len;
607 }
608
609 va_start(ptr, count);
610
611 for (; count; --count)
612 {
613 c = va_arg(ptr, int);
614 *(gen->gen_sdl)++ = c;
615 }
616
617 va_end(ptr);
618 return 0;
619}
620
621
622static ISC_STATUS stuff_literal(gen_t* gen, SLONG literal)

Callers 5

stuff_sdlFunction · 0.85
stuff_sdl_wordFunction · 0.85
stuff_sdl_longFunction · 0.85
gen_sdlFunction · 0.85
stuff_literalFunction · 0.85

Calls 3

GdsClass · 0.85
StrClass · 0.85
errorFunction · 0.70

Tested by

no test coverage detected