X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=StdLib%2FLibC%2FString%2FMisc.c;fp=StdLib%2FLibC%2FString%2FMisc.c;h=0000000000000000000000000000000000000000;hp=f024136446e7a85679ba69515b978c5ba7ccb960;hb=964f432b9b0afe103c41c7613fade3e699118afe;hpb=e2d3a25f1a3135221a9c8061e1b8f90245d727eb diff --git a/StdLib/LibC/String/Misc.c b/StdLib/LibC/String/Misc.c deleted file mode 100644 index f024136446..0000000000 --- a/StdLib/LibC/String/Misc.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - Miscellaneous Functions for . - - Copyright (c) 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -//#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -extern char *sys_errlist[]; - -#if !((defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64)) && defined(__GNUC__)) -/** The memset function copies the value of c (converted to an unsigned char) - into each of the first n characters of the object pointed to by s. - - @return The memset function returns the value of s. -**/ -void * -memset(void *s, int c, size_t n) -{ - return SetMem( s, (UINTN)n, (UINT8)c); -} -#endif - -int -strerror_r(int errnum, char *buf, size_t buflen) -{ - const char *estring; - INTN i; - int retval = 0; - - if( (errnum < 0) || (errnum >= EMAXERRORVAL)) { - (void) AsciiSPrint( buf, ASCII_STRING_MAX, "Unknown Error: %d.", errnum); - retval = EINVAL; - } - else { - estring = sys_errlist[errnum]; - for( i = buflen; i > 0; --i) { - if( (*buf++ = *estring++) == '\0') { - break; - } - } - if(i == 0) { - retval = ERANGE; - } - } - return retval; -} - -/** The strerror function maps the number in errnum to a message string. - Typically, the values for errnum come from errno, but strerror shall map - any value of type int to a message. - - The implementation shall behave as if no library function calls the - strerror function. - - @return The strerror function returns a pointer to the string, the - contents of which are locale specific. The array pointed to - shall not be modified by the program, but may be overwritten by - a subsequent call to the strerror function. -**/ -char * -strerror(int errnum) -{ - static char errorbuf[ASCII_STRING_MAX]; - int status; - - status = strerror_r(errnum, errorbuf, sizeof(errorbuf)); - if(status != 0) { - errno = status; - } - return errorbuf; -} - -/** The strlen function computes the length of the string pointed to by s. - - @return The strlen function returns the number of characters that - precede the terminating null character. -**/ -size_t -strlen(const char *s) -{ - return (size_t)AsciiStrLen( s); -}