OpenCore
1.0.4
OpenCore Bootloader
|
Go to the source code of this file.
Data Structures | |
struct | OC_FLEX_ARRAY_ |
struct | OC_ASCII_STRING_BUFFER_ |
Macros | |
#define | OC_TRACE_FLEX DEBUG_VERBOSE |
Typedefs | |
typedef struct OC_FLEX_ARRAY_ | OC_FLEX_ARRAY |
typedef VOID(* | OC_FLEX_ARRAY_FREE_ITEM) (IN VOID *Item) |
typedef struct OC_ASCII_STRING_BUFFER_ | OC_ASCII_STRING_BUFFER |
Functions | |
VOID | OcFlexArrayFreePointerItem (IN VOID *Item) |
OC_FLEX_ARRAY * | OcFlexArrayInit (IN CONST UINTN ItemSize, IN CONST OC_FLEX_ARRAY_FREE_ITEM FreeItem OPTIONAL) |
VOID * | OcFlexArrayAddItem (IN OUT OC_FLEX_ARRAY *FlexArray) |
VOID * | OcFlexArrayInsertItem (IN OUT OC_FLEX_ARRAY *FlexArray, IN CONST UINTN InsertIndex) |
VOID * | OcFlexArrayItemAt (IN CONST OC_FLEX_ARRAY *FlexArray, IN CONST UINTN Index) |
VOID | OcFlexArrayFree (IN OUT OC_FLEX_ARRAY **FlexArray) |
VOID | OcFlexArrayDiscardItem (IN OUT OC_FLEX_ARRAY *FlexArray, IN CONST BOOLEAN FreeItem) |
VOID | OcFlexArrayFreeContainer (IN OUT OC_FLEX_ARRAY **FlexArray, IN OUT VOID **Items, IN OUT UINTN *Count) |
OC_ASCII_STRING_BUFFER * | OcAsciiStringBufferInit (VOID) |
EFI_STATUS | OcAsciiStringBufferAppend (IN OUT OC_ASCII_STRING_BUFFER *Buffer, IN CONST CHAR8 *AppendString OPTIONAL) |
EFI_STATUS | OcAsciiStringBufferAppendN (IN OUT OC_ASCII_STRING_BUFFER *Buffer, IN CONST CHAR8 *AppendString, OPTIONAL IN CONST UINTN Length) |
EFI_STATUS EFIAPI | OcAsciiStringBufferSPrint (IN OUT OC_ASCII_STRING_BUFFER *Buffer, IN CONST CHAR8 *FormatString,...) |
CHAR8 * | OcAsciiStringBufferFreeContainer (IN OUT OC_ASCII_STRING_BUFFER **StringBuffer) |
VOID | OcAsciiStringBufferFree (IN OUT OC_ASCII_STRING_BUFFER **StringBuffer) |
OC_FLEX_ARRAY * | OcStringSplit (IN CONST VOID *String, IN CONST CHAR16 Delim, IN CONST OC_STRING_FORMAT StringFormat) |
Copyright (C) 2021, Mike Beaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
Definition in file OcFlexArrayLib.h.
#define OC_TRACE_FLEX DEBUG_VERBOSE |
Definition at line 10 of file OcFlexArrayLib.h.
typedef struct OC_ASCII_STRING_BUFFER_ OC_ASCII_STRING_BUFFER |
Definition at line 174 of file OcFlexArrayLib.h.
typedef struct OC_FLEX_ARRAY_ OC_FLEX_ARRAY |
Forward declaration of OC_FLEX_ARRAY structure.
Definition at line 20 of file OcFlexArrayLib.h.
typedef VOID(* OC_FLEX_ARRAY_FREE_ITEM) (IN VOID *Item) |
Free any allocated memory pointed to by flex array item.
[in] | Item | Item to free. |
Definition at line 28 of file OcFlexArrayLib.h.
EFI_STATUS OcAsciiStringBufferAppend | ( | IN OUT OC_ASCII_STRING_BUFFER * | Buffer, |
IN CONST CHAR8 *AppendString | OPTIONAL ) |
Append new string to buffer, resizing if necessary.
[in,out] | StringBuffer | Buffer to modify. |
[in] | AppendString | String to append. If NULL, nothing will be modified. |
EFI_SUCCESS | String was appended. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_UNSUPPORTED | Internal error. |
Definition at line 29 of file AsciiStringBuffer.c.
EFI_STATUS OcAsciiStringBufferAppendN | ( | IN OUT OC_ASCII_STRING_BUFFER * | Buffer, |
IN CONST CHAR8 * | AppendString, | ||
OPTIONAL IN CONST UINTN | Length ) |
Append new substring to buffer, resizing if necessary.
[in,out] | StringBuffer | Buffer to modify. |
[in] | AppendString | String to append. If NULL, nothing will be modified. |
[in] | Length | Maxiumum length of substring to use. 0 means use 0 characters. Use MAX_UINTN for all chars. Ignored if AppendString is NULL. |
EFI_SUCCESS | String was appended. |
EFI_OUT_OF_RESOURCES | Out of memory. |
EFI_UNSUPPORTED | Internal error. |
Definition at line 101 of file AsciiStringBuffer.c.
VOID OcAsciiStringBufferFree | ( | IN OUT OC_ASCII_STRING_BUFFER ** | StringBuffer | ) |
Free string buffer memory; free and discard any allocated resultant string.
[in,out] | StringBuffer | StringBuffer to free. |
Non-NULL | Pointer to pool allocated accumulated string. |
NULL | No data was ever added to the string. |
Definition at line 197 of file AsciiStringBuffer.c.
CHAR8 * OcAsciiStringBufferFreeContainer | ( | IN OUT OC_ASCII_STRING_BUFFER ** | StringBuffer | ) |
Free string buffer memory and return pointer to pool allocated resultant string. Note that if no data was ever appended to the string then the return value will be NULL, not a zero length string.
[in,out] | StringBuffer | StringBuffer to free. |
Non-NULL | Pointer to pool allocated accumulated string. |
NULL | No data was ever added to the string. |
Definition at line 178 of file AsciiStringBuffer.c.
OC_ASCII_STRING_BUFFER * OcAsciiStringBufferInit | ( | VOID | ) |
Initialize string buffer.
Non-NULL | Buffer was created. |
NULL | Out of memory. |
Definition at line 17 of file AsciiStringBuffer.c.
EFI_STATUS EFIAPI OcAsciiStringBufferSPrint | ( | IN OUT OC_ASCII_STRING_BUFFER * | Buffer, |
IN CONST CHAR8 * | FormatString, | ||
... ) |
Safely print to string buffer.
[in,out] | StringBuffer | Buffer to modify. |
[in] | FormatString | A Null-terminated ASCII format string. |
[in] | ... | Variable argument list whose contents are accessed based on the format string specified by FormatString. |
EFI_SUCCESS | When data was printed to string buffer. |
EFI_OUT_OF_RESOURCES | Out of memory increasing string buffer sufficiently to print to. |
Definition at line 140 of file AsciiStringBuffer.c.
VOID * OcFlexArrayAddItem | ( | IN OUT OC_FLEX_ARRAY * | FlexArray | ) |
Add new item to flex array, resizing if necessary. New item memory is zeroed.
[in,out] | FlexArray | Flex array to modify. |
Non-NULL | Address of item created. |
NULL | Out of memory, in which case FlexArray->Items will be set to NULL, but FlexArray itself will still be allocated. |
Definition at line 136 of file FlexArray.c.
VOID OcFlexArrayDiscardItem | ( | IN OUT OC_FLEX_ARRAY * | FlexArray, |
IN CONST BOOLEAN | FreeItem ) |
Discard last item on flex array, optionally calling item free method.
[in,out] | FlexArray | Flex array to modify. |
[in] | FreeItem | Whether to call item free method. |
Definition at line 238 of file FlexArray.c.
VOID OcFlexArrayFree | ( | IN OUT OC_FLEX_ARRAY ** | FlexArray | ) |
Free flex array.
[in,out] | FlexArray | Flex array to free. |
VOID OcFlexArrayFreeContainer | ( | IN OUT OC_FLEX_ARRAY ** | FlexArray, |
IN OUT VOID ** | Items, | ||
IN OUT UINTN * | Count ) |
Free dynamic container object, but do not free and pass back out allocated items with item count.
[in,out] | FlexArray | Flex array to free. |
[in,out] | Items | Pool allocated flex array item list. |
[in,out] | Count | Item list count. |
VOID OcFlexArrayFreePointerItem | ( | IN VOID * | Item | ) |
Utility method to free memory pointed to by flex array item when the item is a single pointer, or when the only allocated memory is pointed to by a pointer which is the first element.
[in] | Item | Flex array item to free. |
Definition at line 18 of file FlexArray.c.
OC_FLEX_ARRAY * OcFlexArrayInit | ( | IN CONST UINTN | ItemSize, |
IN CONST OC_FLEX_ARRAY_FREE_ITEM FreeItem | OPTIONAL ) |
Initialize flex array.
[in] | ItemSize | Size of each item in the array. |
[in] | FreeItem | Method to free one item, called once per item by OcFlexArrayFree; may be NULL if there is nothing pointed to by pool items which needs freeing. |
Non-NULL | Flex array was created. |
NULL | Out of memory. |
Definition at line 31 of file FlexArray.c.
VOID * OcFlexArrayInsertItem | ( | IN OUT OC_FLEX_ARRAY * | FlexArray, |
IN CONST UINTN | InsertIndex ) |
Insert new item at position in flex array, resizing array if necessary. New item memory is zeroed.
[in,out] | FlexArray | Flex array to modify. |
[in] | InsertIndex | Index at which to insert; must be less than or equal to current item count. |
Non-NULL | Address of item created. |
NULL | Out of memory, in which case FlexArray->Items will be set to NULL, but FlexArray itself will still be allocated. |
Definition at line 156 of file FlexArray.c.
VOID * OcFlexArrayItemAt | ( | IN CONST OC_FLEX_ARRAY * | FlexArray, |
IN CONST UINTN | Index ) |
Return item at index in array.
[in,out] | FlexArray | Flex array to access. |
[in,out] | Index | Index of item to return. |
Non-NULL | Item. |
NULL | Out-of-range item requested. This also ASSERTs. |
Definition at line 189 of file FlexArray.c.
OC_FLEX_ARRAY * OcStringSplit | ( | IN CONST VOID * | String, |
IN CONST CHAR16 | Delim, | ||
IN CONST OC_STRING_FORMAT | StringFormat ) |
Split string by delimiter.
[in] | String | A Null-terminated string. |
[in] | Delim | Delimiter to search in String. |
[in] | StringFormat | Are option names and values Unicode or ASCII? |
Definition at line 15 of file FlexString.c.