MCPcopy Create free account
hub / github.com/F-Stack/f-stack / Alloc

Method Alloc

adapter/micro_thread/mt_api.cpp:679–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677 {}
678
679 int Alloc(int len)
680 {
681 if(len<len_)
682 {
683 return -1;
684 }
685
686 if(len==0)
687 {
688 len = BUF_ALIGNMENT_SIZE;
689 }
690 if(len_==len)
691 {
692 return 0;
693 }
694
695 len_ = BUF_ALIGN_SIZE(len);
696 if(len_==0)
697 {
698 len_ = BUF_DEFAULT_SIZE;
699 }
700 len_watermark_ = len_-BUF_ALIGNMENT_SIZE;
701 char* tmp = (char*)realloc(buf_, len_);
702 if(tmp==NULL)
703 {
704 return -2;
705 }
706
707 buf_ = tmp;
708 return 0;
709 }
710
711 void reset()
712 {

Callers 1

mt_tcp_check_recvFunction · 0.80

Calls 1

reallocFunction · 0.50

Tested by

no test coverage detected