]>
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.
29 IN EFI_EDITOR_LINE
*Src
32 EFI_EDITOR_LINE
*Dest
;
35 // allocate for the line structure
37 Dest
= AllocateZeroPool (sizeof (EFI_EDITOR_LINE
));
42 // allocate and set the line buffer
44 Dest
->Buffer
= CatSPrint (NULL
, L
"%s", Src
->Buffer
);
45 if (Dest
->Buffer
== NULL
) {
51 // set the other structure members
53 Dest
->Signature
= LINE_LIST_SIGNATURE
;
54 Dest
->Size
= Src
->Size
;
55 Dest
->TotalSize
= Dest
->Size
;
56 Dest
->Type
= Src
->Type
;
57 Dest
->Link
= Src
->Link
;
63 Free a EFI_EDITOR_LINE structure.
65 @param Src The line structure to free.
70 IN EFI_EDITOR_LINE
*Src
77 // free the line buffer and then the line structure itself
79 SHELL_FREE_NON_NULL (Src
->Buffer
);
80 SHELL_FREE_NON_NULL (Src
);