public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation
@ 2017-04-17  6:28 Ruiyu Ni
  2017-04-17 13:35 ` Carsey, Jaben
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-04-17  6:28 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael Turner, Jaben Carsey

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
---
 ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
index 09f2c56..3b13e62 100755
--- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
+++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
@@ -1,7 +1,7 @@
 /** @file
   Main file for support of shell consist mapping.
 
-  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution. The full text of the license may be found at
@@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName (
   DEVICE_CONSIST_MAPPING_INFO MappingInfo;
   EFI_DEVICE_PATH_PROTOCOL    *HIDevicePath;
   UINTN                       Index;
-  CHAR16                      *NewStr;
 
   ASSERT(DevicePath         != NULL);
   ASSERT(Table  != NULL);
@@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName (
     return NULL;
   }
 
-  NewStr = ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * sizeof (CHAR16), Str.Str);
-  if (NewStr == NULL) {
-    SHELL_FREE_NON_NULL (Str.Str);
-    return (NULL);
-  }
-  NewStr[Str.Len] = CHAR_NULL;
-  return NewStr;
+  return Str.Str;
 }
 
 /**
-- 
2.9.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation
  2017-04-17  6:28 [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation Ruiyu Ni
@ 2017-04-17 13:35 ` Carsey, Jaben
  0 siblings, 0 replies; 2+ messages in thread
From: Carsey, Jaben @ 2017-04-17 13:35 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Michael Turner

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Sunday, April 16, 2017 11:29 PM
> To: edk2-devel@lists.01.org
> Cc: Michael Turner <Michael.Turner@microsoft.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Subject: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory
> reallocation
> Importance: High
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> index 09f2c56..3b13e62 100755
> --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Main file for support of shell consist mapping.
> 
> -  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2005 - 2017, Intel Corporation. All rights
> + reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution. The full text of the license may be found
> at @@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName (
>    DEVICE_CONSIST_MAPPING_INFO MappingInfo;
>    EFI_DEVICE_PATH_PROTOCOL    *HIDevicePath;
>    UINTN                       Index;
> -  CHAR16                      *NewStr;
> 
>    ASSERT(DevicePath         != NULL);
>    ASSERT(Table  != NULL);
> @@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName (
>      return NULL;
>    }
> 
> -  NewStr = ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * sizeof
> (CHAR16), Str.Str);
> -  if (NewStr == NULL) {
> -    SHELL_FREE_NON_NULL (Str.Str);
> -    return (NULL);
> -  }
> -  NewStr[Str.Len] = CHAR_NULL;
> -  return NewStr;
> +  return Str.Str;
>  }
> 
>  /**
> --
> 2.9.0.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-17 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-17  6:28 [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation Ruiyu Ni
2017-04-17 13:35 ` Carsey, Jaben

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