/* Internal function reserves the enough buffer for current opcode. When the buffer is not enough, Opcode buffer will be extended. */
UINT8* EFIAPI InternalHiiGrowOpCodeHandle(IN VOID *OpCodeHandle, IN UINTN Size)
/* Internal function reserves the enough buffer for current opcode. When the buffer is not enough, Opcode buffer will be extended. */
UINT8* EFIAPI InternalHiiGrowOpCodeHandle(IN VOID *OpCodeHandle, IN UINTN Size)
{
  HII_LIB_OPCODE_BUFFER  *OpCodeBuffer;
  UINT8                  *Buffer;
  ASSERT (OpCodeHandle != NULL);
  OpCodeBuffer = (HII_LIB_OPCODE_BUFFER *)OpCodeHandle;
  if (OpCodeBuffer->Position + Size > OpCodeBuffer->BufferSize) {
    Buffer = ReallocatePool (
               OpCodeBuffer->BufferSize,
               OpCodeBuffer->BufferSize + (Size + HII_LIB_OPCODE_ALLOCATION_SIZE),
               OpCodeBuffer->Buffer
               );
    ASSERT (Buffer != NULL);
    OpCodeBuffer->Buffer      = Buffer;
    OpCodeBuffer->BufferSize += (Size + HII_LIB_OPCODE_ALLOCATION_SIZE);
  }
  Buffer                  = OpCodeBuffer->Buffer + OpCodeBuffer->Position;
  OpCodeBuffer->Position += Size;
  return Buffer;
}