From: "Girish Mahadevan via groups.io" <gmahadevan=nvidia.com@groups.io>
To: <sami.mujawar@arm.com>, <Alexei.Fedorov@arm.com>,
<pierre.gondois@arm.com>, <abner.chang@amd.com>,
<Samer.El-Haj-Mahmoud@arm.com>, <Jose.Marinho@arm.com>
Cc: <gmahadevan@nvidia.com>, <jbrasen@nvidia.com>,
<ashishsingha@nvidia.com>, <nramirez@nvidia.com>,
<devel@edk2.groups.io>
Subject: [edk2-devel] [staging/dynamictables-reorg PATCH v0 01/12] DynamicTablesPkg: SmbiosStringLib: Add new helper macro
Date: Wed, 5 Feb 2025 15:08:59 -0700 [thread overview]
Message-ID: <d93784d0d5b66a0a7795698acfe891ed0e5de669.1738793024.git.gmahadevan@nvidia.com> (raw)
In-Reply-To: <cover.1738793024.git.gmahadevan@nvidia.com>
Add a new helper macro which is a wrapper over StringTableAddString().
It adds a string to the string table, and if the string is NULL or empty,
add "" string instead.
Signed-off-by: Dat Mach <dmach@nvidia.com>
Signed-off-by: Nick Ramirez <nramirez@nvidia.com>
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
---
.../Include/Library/SmbiosStringTableLib.h | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/DynamicTablesPkg/Include/Library/SmbiosStringTableLib.h b/DynamicTablesPkg/Include/Library/SmbiosStringTableLib.h
index fb183d427f..b95d83f457 100644
--- a/DynamicTablesPkg/Include/Library/SmbiosStringTableLib.h
+++ b/DynamicTablesPkg/Include/Library/SmbiosStringTableLib.h
@@ -2,6 +2,7 @@
SMBIOS String Table Helper library.
Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -116,4 +117,23 @@ StringTableFree (
IN STRING_TABLE *CONST StrTable
);
+/** STRING_TABLE_ADD_STRING macro is the wrapper over StringTableAddString().
+ It adds a string to the string table, and if the string is NULL or empty,
+ add "" string instead.
+
+ @param [IN] StrTable Pointer to the string table
+ @param [IN] Str Pointer to the string
+ @param [OUT] StrRef The string field reference of the added string
+**/
+#define STRING_TABLE_ADD_STRING(StrTable, String, StringRef) \
+ StringRef = 0; \
+ if ((String != NULL) && (String[0] != '\0')) { \
+ Status = StringTableAddString (&StrTable, String, &StringRef); \
+ } else { \
+ Status = StringTableAddString (&StrTable, "", &StringRef); \
+ } \
+ if (EFI_ERROR (Status)) { \
+ DEBUG ((DEBUG_ERROR, "Failed to add "#String" string %r\n", Status)); \
+ } \
+
#endif // SMBIOS_STRING_TABLE_H_
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121084): https://edk2.groups.io/g/devel/message/121084
Mute This Topic: https://groups.io/mt/111022000/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2025-02-05 22:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 22:08 [edk2-devel] [staging/dynamictables-reorg PATCH v0 00/12] DynamicTablesPkg: Add SMBIOS table generation support Girish Mahadevan via groups.io
2025-02-05 22:08 ` Girish Mahadevan via groups.io [this message]
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 02/12] DynamicTablesPkg: Define a SMBIOS Structure/Table type Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 03/12] DynamicTablesPkg: Add SMBIOS table dispatcher Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 04/12] DynamicTablesPkg: Add extern call to build SMBIOS table Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 05/12] DynamicTablesPkg: Update SMBIOS dispatcher dependency table Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 06/12] DynamicTablesPkg: Add Ordered dispatch support for SMBIOS tables Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 07/12] DynamicTablesPkg: Add SMBIOS table generation Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 08/12] DynamicTablesPkg: Split the ACPI and SMBIOS table generators Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 09/12] DynamicTablesPkg: Introduce new namespace for SMBIOS Objects Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 10/12] DynamicTablesPkg: Smbios Memory Device (Type 17) Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16) Girish Mahadevan via groups.io
2025-02-05 22:09 ` [edk2-devel] [staging/dynamictables-reorg PATCH v0 12/12] DynamicTablesPkg: Smbios Memory Array Mapped Address (Type 19) Girish Mahadevan via groups.io
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d93784d0d5b66a0a7795698acfe891ed0e5de669.1738793024.git.gmahadevan@nvidia.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox