[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Do not create attribute for NULL object

Nickle Wang via groups.io posted 1 patch 11 months, 4 weeks ago
Failed in applying to current master (apply log)
RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Do not create attribute for NULL object
Posted by Nickle Wang via groups.io 11 months, 4 weeks ago
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 <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.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 212f0de1..964904a2 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
 
@@ -994,7 +994,6 @@ InsertJsonStringObj (
   )
 {
   json_t          *JsonValue;
-  RedfishCS_char  NullStr[] = "";
   RedfishCS_char  *InsertStr;
 
   InsertStr = StringValue;
@@ -1003,7 +1002,7 @@ InsertJsonStringObj (
   }
 
   if (InsertStr == (char *)NULL) {
-    InsertStr = NullStr;
+    return RedfishCS_status_success;
   }
 
   JsonValue = json_string (InsertStr);
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104224): https://edk2.groups.io/g/devel/message/104224
Mute This Topic: https://groups.io/mt/98741634/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Do not create attribute for NULL object
Posted by Chang, Abner via groups.io 11 months, 4 weeks ago
[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Sunday, May 7, 2023 10:29 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: Do not create
> attribute for NULL object
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> 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 <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.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 212f0de1..964904a2 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
> 
> @@ -994,7 +994,6 @@ InsertJsonStringObj (
>    )
>  {
>    json_t          *JsonValue;
> -  RedfishCS_char  NullStr[] = "";
>    RedfishCS_char  *InsertStr;
> 
>    InsertStr = StringValue;
> @@ -1003,7 +1002,7 @@ InsertJsonStringObj (
>    }
> 
>    if (InsertStr == (char *)NULL) {
> -    InsertStr = NullStr;
> +    return RedfishCS_status_success;
>    }
> 
>    JsonValue = json_string (InsertStr);
> --
> 2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104231): https://edk2.groups.io/g/devel/message/104231
Mute This Topic: https://groups.io/mt/98741634/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-