MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / Balloc

Function Balloc

strings/dtoa.c:659–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657*/
658
659static Bigint *Balloc(int k, Stack_alloc *alloc)
660{
661 Bigint *rv;
662 DBUG_ASSERT(k <= Kmax);
663 if (k <= Kmax && alloc->freelist[k])
664 {
665 rv= alloc->freelist[k];
666 alloc->freelist[k]= rv->p.next;
667 }
668 else
669 {
670 int x, len;
671
672 x= 1 << k;
673 len= MY_ALIGN(sizeof(Bigint) + x * sizeof(ULong), SIZEOF_CHARP);
674
675 if (alloc->free + len <= alloc->end)
676 {
677 rv= (Bigint*) alloc->free;
678 alloc->free+= len;
679 }
680 else
681 rv= (Bigint*) malloc(len);
682
683 rv->k= k;
684 rv->maxwds= x;
685 }
686 rv->sign= rv->wds= 0;
687 rv->p.x= (ULong*) (rv + 1);
688 return rv;
689}
690
691
692/*

Callers 9

multaddFunction · 0.85
s2bFunction · 0.85
i2bFunction · 0.85
multFunction · 0.85
lshiftFunction · 0.85
diffFunction · 0.85
d2bFunction · 0.85
my_strtod_intFunction · 0.85
dtoaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected