]>
git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c
2 Implementation of various string and line routines.
4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "TextEditor.h"
19 Duplicate a EFI_EDITOR_LINE structure.
21 @param Src The line structure to copy from.
23 @retval NULL A memory allocation failed.
24 @return a pointer to the newly allcoated line.
28 IN EFI_EDITOR_LINE
*Src
31 EFI_EDITOR_LINE
*Dest
;
34 // allocate for the line structure
36 Dest
= AllocateZeroPool (sizeof (EFI_EDITOR_LINE
));
41 // allocate and set the line buffer
43 Dest
->Buffer
= CatSPrint (NULL
, L
"%s", Src
->Buffer
);
44 if (Dest
->Buffer
== NULL
) {
50 // set the other structure members
52 Dest
->Signature
= LINE_LIST_SIGNATURE
;
53 Dest
->Size
= Src
->Size
;
54 Dest
->TotalSize
= Dest
->Size
;
55 Dest
->Type
= Src
->Type
;
56 Dest
->Link
= Src
->Link
;
62 Free a EFI_EDITOR_LINE structure.
64 @param Src The line structure to free.
68 IN EFI_EDITOR_LINE
*Src
75 // free the line buffer and then the line structure itself
77 SHELL_FREE_NON_NULL (Src
->Buffer
);
78 SHELL_FREE_NON_NULL (Src
);