From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=68.232.149.229; helo=esa6.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa6.dell-outbound.iphmx.com (esa6.dell-outbound.iphmx.com [68.232.149.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8328021B02822 for ; Thu, 9 Aug 2018 08:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1533829346; x=1565365346; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=q9orgJKBCvduRciNdYgtO/5zSEk5RbLqcRvTdXmND1w=; b=NJ8NCaDsWM8Z+oHciQs5wjV3/kOUjRuyD636JCdy8b1aWQAh+C3pGipe wo5KzNkIoE1DloM+cyW2TIdqp3Zwzsz4o8BDwbmaI5K6EUh5qhYOlb0H/ 1tRJtlZwrs9ZJhYSgixxrUclMGscPPXH5n9BwUbysBM0AQbsOGwm5Zytu U=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2FkAAAbWGxbhyeV50NcGgEBAQEBAgE?= =?us-ascii?q?BAQEIAQEBAYQxfygKi39fi1WCDYF3lAYUgWYLGAsLhD4CgyIhNBgBAgEBAgE?= =?us-ascii?q?BAgEBAhABAQEKCwkIKSMMgjUiEYEIAQEBAQEBAQEBIyoCDWMBAQEEAQEQFRM?= =?us-ascii?q?0CwwEAgEIEQQBAR8JBycBHgkIAgQOBQgagn4BggAPoGuJVwEBAYFoM4pSBYk?= =?us-ascii?q?UgheBEoMSgxsBAwEXgS+FbgKHfoR8jVEHAoYghT+DaoFXjGOIJYJXhHKCaQI?= =?us-ascii?q?EAgQFAhSBQYILcFCCaYIziDcrhT5vAYx3gRsBAQ?= X-IPAS-Result: =?us-ascii?q?A2FkAAAbWGxbhyeV50NcGgEBAQEBAgEBAQEIAQEBAYQxf?= =?us-ascii?q?ygKi39fi1WCDYF3lAYUgWYLGAsLhD4CgyIhNBgBAgEBAgEBAgEBAhABAQEKC?= =?us-ascii?q?wkIKSMMgjUiEYEIAQEBAQEBAQEBIyoCDWMBAQEEAQEQFRM0CwwEAgEIEQQBA?= =?us-ascii?q?R8JBycBHgkIAgQOBQgagn4BggAPoGuJVwEBAYFoM4pSBYkUgheBEoMSgxsBA?= =?us-ascii?q?wEXgS+FbgKHfoR8jVEHAoYghT+DaoFXjGOIJYJXhHKCaQIEAgQFAhSBQYILc?= =?us-ascii?q?FCCaYIziDcrhT5vAYx3gRsBAQ?= Received: from mx0a-00154901.pphosted.com ([67.231.149.39]) by esa6.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Aug 2018 10:42:01 -0500 Received: from pps.filterd (m0142693.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w79FbteA121771 for ; Thu, 9 Aug 2018 11:42:01 -0400 Received: from esa2.dell-outbound2.iphmx.com (esa2.dell-outbound2.iphmx.com [68.232.153.202]) by mx0a-00154901.pphosted.com with ESMTP id 2kr402x9p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 09 Aug 2018 11:42:00 -0400 From: Received: from ausxipps301.us.dell.com ([143.166.148.223]) by esa2.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 09 Aug 2018 21:41:40 +0600 X-LoopCount0: from 10.166.136.211 X-IronPort-AV: E=Sophos;i="5.53,215,1531803600"; d="scan'208";a="203657754" To: CC: , , Thread-Topic: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions Thread-Index: AQHUL6PKuSPZIbTuwUK8Mpw1GgSJTaS3jy8g Date: Thu, 9 Aug 2018 15:41:58 +0000 Message-ID: <809ce67145704edeb41da02b7e5bdce5@ausx13mps335.AMER.DELL.COM> References: <20180809054155.30244-1-shenglei.zhang@intel.com> In-Reply-To: <20180809054155.30244-1-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Enabled=True; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SiteId=945c199a-83a2-4e80-9f8c-5a91be5752dd; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Owner=Jim_Dailey@Dell.com; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SetDate=2018-08-09T15:40:03.7154665Z; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Name=External Public; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Application=Microsoft Azure Information Protection; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Extended_MSFT_Method=Manual; Sensitivity=External Public x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.18.86] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-09_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090160 Subject: Re: [PATCH] ShellPkg Shell: Remove redundant functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 15:42:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The InvalidChars[] array is only used in function IsValidCommandName(). The array should be deleted also, I think. Regards, Jim -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of shen= glei Sent: Thursday, August 9, 2018 12:42 AM To: edk2-devel@lists.01.org Cc: Jaben Carsey; Ruiyu Ni Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions The redundant functions which are never called have been removed. They are InternalShellProtocolDebugPrintMessage, UpdateFileName,RemoveFileTag and IsValidCommandName. https://bugzilla.tianocore.org/show_bug.cgi?id=3D1066 Cc: Jaben Carsey Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shenglei --- ShellPkg/Application/Shell/Shell.c | 29 ------- ShellPkg/Application/Shell/Shell.h | 13 --- .../Shell/ShellParametersProtocol.c | 24 ------ ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------ 4 files changed, 1 insertion(+), 146 deletions(-) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shel= l/Shell.c index 47ae3c373c..397cfd1994 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -2752,35 +2752,6 @@ RunCommand( =20 =20 STATIC CONST UINT16 InvalidChars[] =3D {L'*', L'?', L'<', L'>', L'\\', L'/= ', L'\"', 0x0001, 0x0002}; -/** - Function determines if the CommandName COULD be a valid command. It doe= s not determine whether - this is a valid command. It only checks for invalid characters. - - @param[in] CommandName The name to check - - @retval TRUE CommandName could be a command name - @retval FALSE CommandName could not be a valid command name -**/ -BOOLEAN -IsValidCommandName( - IN CONST CHAR16 *CommandName - ) -{ - UINTN Count; - if (CommandName =3D=3D NULL) { - ASSERT(FALSE); - return (FALSE); - } - for ( Count =3D 0 - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0]) - ; Count++ - ){ - if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) = !=3D NULL) { - return (FALSE); - } - } - return (TRUE); -} =20 /** Function to process a NSH script file via SHELL_FILE_HANDLE. diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shel= l/Shell.h index 69b19c6a2d..bad8f08d47 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -309,19 +309,6 @@ RunShellCommand( OUT EFI_STATUS *CommandStatus ); =20 -/** - Function determines if the CommandName COULD be a valid command. It doe= s not determine whether - this is a valid command. It only checks for invalid characters. - - @param[in] CommandName The name to check - - @retval TRUE CommandName could be a command name - @retval FALSE CommandName could not be a valid command name -**/ -BOOLEAN -IsValidCommandName( - IN CONST CHAR16 *CommandName - ); =20 /** Function to process a NSH script file via SHELL_FILE_HANDLE. diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPk= g/Application/Shell/ShellParametersProtocol.c index 90889a3725..a21c690518 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -626,30 +626,6 @@ FixVarName ( return (FixFileName(Copy)); } =20 -/** - Remove the unicode file tag from the begining of the file buffer since t= hat will not be - used by StdIn. - - @param[in] Handle Pointer to the handle of the file to be processed. - - @retval EFI_SUCCESS The unicode file tag has been moved successfully. -**/ -EFI_STATUS -RemoveFileTag( - IN SHELL_FILE_HANDLE *Handle - ) -{ - UINTN CharSize; - CHAR16 CharBuffer; - - CharSize =3D sizeof(CHAR16); - CharBuffer =3D 0; - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer); - if (CharBuffer !=3D gUnicodeFileTag) { - gEfiShellProtocol->SetFilePosition(*Handle, 0); - } - return (EFI_SUCCESS); -} =20 /** Write the unicode file tag to the specified file. diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Applicat= ion/Shell/ShellProtocol.c index f2ca2029e3..8cf924b384 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent( return (FALSE); } =20 -/** - Internal worker debug helper function to print out maps as they are adde= d. - - @param[in] Mapping string mapping that has been added - @param[in] DevicePath pointer to device path that has been mapped. - - @retval EFI_SUCCESS the operation was successful. - @return other an error ocurred - - @sa LocateHandle - @sa OpenProtocol -**/ -EFI_STATUS -InternalShellProtocolDebugPrintMessage ( - IN CONST CHAR16 *Mapping, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - CHAR16 *Temp; - - Status =3D EFI_SUCCESS; - DEBUG_CODE_BEGIN(); - - if (Mapping !=3D NULL) { - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); - } - Temp =3D ConvertDevicePathToText(DevicePath, TRUE, TRUE); - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); - FreePool(Temp); - - DEBUG_CODE_END(); - return (Status); -} =20 /** This function creates a mapping for a device path. @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName( // We are opening a regular file. // DevicePath =3D EfiShellGetDevicePathFromFilePath(FileName); -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath);)= ; + if (DevicePath =3D=3D NULL) { return (EFI_NOT_FOUND); } @@ -2261,52 +2227,7 @@ EfiShellGetGuidName( return (EFI_SUCCESS); } =20 -/** - Updates a file name to be preceeded by the mapped drive name - - @param[in] BasePath the Mapped drive name to prepend - @param[in, out] Path pointer to pointer to the file name to update. - - @retval EFI_SUCCESS - @retval EFI_OUT_OF_RESOURCES -**/ -EFI_STATUS -UpdateFileName( - IN CONST CHAR16 *BasePath, - IN OUT CHAR16 **Path - ) -{ - CHAR16 *Path2; - UINTN Path2Size; - - Path2Size =3D 0; - Path2 =3D NULL; - - ASSERT(Path !=3D NULL); - ASSERT(*Path !=3D NULL); - ASSERT(BasePath !=3D NULL); - - // - // convert a local path to an absolute path - // - if (StrStr(*Path, L":") =3D=3D NULL) { - ASSERT((Path2 =3D=3D NULL && Path2Size =3D=3D 0) || (Path2 !=3D NULL))= ; - StrnCatGrow(&Path2, &Path2Size, BasePath, 0); - if (Path2 =3D=3D NULL) { - return (EFI_OUT_OF_RESOURCES); - } - ASSERT((Path2 =3D=3D NULL && Path2Size =3D=3D 0) || (Path2 !=3D NULL))= ; - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] =3D=3D L'\\'?(*Path) + 1 :*= Path, 0); - if (Path2 =3D=3D NULL) { - return (EFI_OUT_OF_RESOURCES); - } - } - - FreePool(*Path); - (*Path) =3D Path2; =20 - return (EFI_SUCCESS); -} =20 /** If FileHandle is a directory then the function reads from FileHandle and= reads in --=20 2.18.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel