MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilRecalloc

Function ILAPIENTRY ilRecalloc

DevIL/src-IL/src/il_stack.cpp:553–571  ·  view source on GitHub ↗

Like realloc but sets new memory to 0.

Source from the content-addressed store, hash-verified

551
552// Like realloc but sets new memory to 0.
553void* ILAPIENTRY ilRecalloc(void *Ptr, ILuint OldSize, ILuint NewSize)
554{
555 void *Temp = ialloc(NewSize);
556 ILuint CopySize = (OldSize < NewSize) ? OldSize : NewSize;
557
558 if (Temp != NULL) {
559 if (Ptr != NULL) {
560 memcpy(Temp, Ptr, CopySize);
561 ifree(Ptr);
562 }
563
564 Ptr = Temp;
565
566 if (OldSize < NewSize)
567 imemclear((ILubyte*)Temp + OldSize, NewSize - OldSize);
568 }
569
570 return Temp;
571}
572
573
574// To keep Visual Studio happy with its unhappiness with ILAPIENTRY for atexit

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected