public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Do not create attribute for NULL object
@ 2022-04-21  3:16 Nickle Wang
  0 siblings, 0 replies; only message in thread
From: Nickle Wang @ 2022-04-21  3:16 UTC (permalink / raw)
  To: devel; +Cc: Nickle Wang, Abner Chang

While input object is NULL, do not generate attribute with empty string
value. This can reduce the size of HTTP context while sending "PATCH"
or "POST" request to Redfish service.

Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
---
 RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
index 624314a8ec..02e4c50c5f 100644
--- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
+++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
@@ -1,6 +1,6 @@
 /** @file
 
-  (C) Copyright 2018-2021 Hewlett Packard Enterprise Development LP<BR>
+  (C) Copyright 2018-2022 Hewlett Packard Enterprise Development LP<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -795,7 +795,6 @@ RedfishCS_status GetRedfishPropertyVague (void *Cs, json_t *JsonObj, char *Key,
 RedfishCS_status InsertJsonStringObj (json_t *ParentJsonObj, char *Key, RedfishCS_char *StringValue)
 {
   json_t  *JsonValue;
-  RedfishCS_char NullStr[] = "";
   RedfishCS_char *InsertStr;
 
   InsertStr = StringValue;
@@ -803,7 +802,7 @@ RedfishCS_status InsertJsonStringObj (json_t *ParentJsonObj, char *Key, RedfishC
     return RedfishCS_status_invalid_parameter;
   }
   if (InsertStr == (char *)NULL) {
-    InsertStr = NullStr;
+    return RedfishCS_status_success;
   }
   JsonValue = json_string(InsertStr);
   if (JsonValue == NULL) {
-- 
2.32.0.windows.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-21  3:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-21  3:16 [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Do not create attribute for NULL object Nickle Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox