Adjusts the size of a previously allocated buffer. @param OldPool - A pointer to the buffer whose size is being adjusted. @param OldSize - The size of the current buffer. @param NewSize - The size of the new buffer. @return The newly allocated buffer. @retval NULL Allocation failed. **/
| 274 | |
| 275 | **/ |
| 276 | VOID * |
| 277 | EfiReallocatePool ( |
| 278 | IN VOID *OldPool, |
| 279 | IN UINTN OldSize, |
| 280 | IN UINTN NewSize |
| 281 | ) |
| 282 | { |
| 283 | VOID *NewPool; |
| 284 | |
| 285 | NewPool = NULL; |
| 286 | if (NewSize != 0) { |
| 287 | NewPool = (__typeof__(NewPool))AllocateZeroPool(NewSize); |
| 288 | } |
| 289 | |
| 290 | if (OldPool != NULL) { |
| 291 | if (NewPool != NULL) { |
| 292 | CopyMem(NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); |
| 293 | } |
| 294 | |
| 295 | FreePool(OldPool); |
| 296 | } |
| 297 | |
| 298 | return NewPool; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | Compare two EFI_TIME data. |
no test coverage detected