]>
git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c
db18010e456e865e7195722aa5add0e87ea4e890
2 Implementation of various string and line routines.
4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "TextEditor.h"
13 Duplicate a EFI_EDITOR_LINE structure.
15 @param Src The line structure to copy from.
17 @retval NULL A memory allocation failed.
18 @return a pointer to the newly allcoated line.
22 IN EFI_EDITOR_LINE
*Src
25 EFI_EDITOR_LINE
*Dest
;
28 // allocate for the line structure
30 Dest
= AllocateZeroPool (sizeof (EFI_EDITOR_LINE
));
35 // allocate and set the line buffer
37 Dest
->Buffer
= CatSPrint (NULL
, L
"%s", Src
->Buffer
);
38 if (Dest
->Buffer
== NULL
) {
44 // set the other structure members
46 Dest
->Signature
= LINE_LIST_SIGNATURE
;
47 Dest
->Size
= Src
->Size
;
48 Dest
->TotalSize
= Dest
->Size
;
49 Dest
->Type
= Src
->Type
;
50 Dest
->Link
= Src
->Link
;
56 Free a EFI_EDITOR_LINE structure.
58 @param Src The line structure to free.
62 IN EFI_EDITOR_LINE
*Src
69 // free the line buffer and then the line structure itself
71 SHELL_FREE_NON_NULL (Src
->Buffer
);
72 SHELL_FREE_NON_NULL (Src
);