]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/String/Copying.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / LibC / String / Copying.c
diff --git a/StdLib/LibC/String/Copying.c b/StdLib/LibC/String/Copying.c
deleted file mode 100644 (file)
index 3234ecc..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/** @file\r
-    Copying Functions for <string.h>.\r
-\r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
-    This program and the accompanying materials are licensed and made available under\r
-    the terms and conditions of the BSD License that accompanies this distribution.\r
-    The full text of the license may be found at\r
-    http://opensource.org/licenses/bsd-license.php.\r
-\r
-    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include  <Uefi.h>\r
-#include  <Library/BaseLib.h>\r
-#include  <Library/BaseMemoryLib.h>\r
-\r
-#include  <LibConfig.h>\r
-\r
-#include  <stdlib.h>\r
-#include  <string.h>\r
-\r
-/** Do not define memcpy for IPF+GCC or ARM/AARCH64+GCC builds.\r
-    For IPF, using a GCC compiler, the memcpy function is converted to\r
-    CopyMem by objcpy during build.\r
-    For ARM/AARCH64, the memcpy function is provided by the CompilerIntrinsics library.\r
-**/\r
-#if !((defined(MDE_CPU_IPF) || defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64)) && defined(__GNUC__))\r
-/** The memcpy function copies n characters from the object pointed to by s2\r
-    into the object pointed to by s1.\r
-\r
-    The implementation is reentrant and handles the case where s2 overlaps s1.\r
-\r
-    @return   The memcpy function returns the value of s1.\r
-**/\r
-void *\r
-memcpy(void * __restrict s1, const void * __restrict s2, size_t n)\r
-{\r
-  return CopyMem( s1, s2, n);\r
-}\r
-#endif  /* !(defined(MDE_CPU_IPF) && defined(__GCC)) */\r
-\r
-#if !(defined(MDE_CPU_ARM) && defined(__GNUC__))\r
-/** The memmove function copies n characters from the object pointed to by s2\r
-    into the object pointed to by s1. Copying takes place as if the n\r
-    characters from the object pointed to by s2 are first copied into a\r
-    temporary array of n characters that does not overlap the objects pointed\r
-    to by s1 and s2, and then the n characters from the temporary array are\r
-    copied into the object pointed to by s1.\r
-\r
-    This is a version of memcpy that is guaranteed to work when s1 and s2\r
-    overlap.  Since our implementation of memcpy already handles overlap,\r
-    memmove can be identical to memcpy.\r
-\r
-    @return   The memmove function returns the value of s1.\r
-**/\r
-void *\r
-memmove(void *s1, const void *s2, size_t n)\r
-{\r
-  return CopyMem( s1, s2, n);\r
-}\r
-#endif\r
-\r
-/** The strcpy function copies the string pointed to by s2 (including the\r
-    terminating null character) into the array pointed to by s1. If copying\r
-    takes place between objects that overlap, the behavior is undefined.\r
-\r
-    @return   The strcpy function returns the value of s1.\r
-**/\r
-char *\r
-strcpy(char * __restrict s1, const char * __restrict s2)\r
-{\r
-  //char *s1ret = s1;\r
-\r
-  //while ( *s1++ = *s2++)  /* Empty Body */;\r
-  //return(s1ret);\r
-  return AsciiStrCpy( s1, s2);\r
-}\r
-\r
-/** The strncpy function copies not more than n characters (characters that\r
-    follow a null character are not copied) from the array pointed to by s2 to\r
-    the array pointed to by s1. If copying takes place between objects that\r
-    overlap, the behavior is undefined.\r
-\r
-    If the array pointed to by s2 is a string that is shorter than n\r
-    characters, null characters are appended to the copy in the array pointed\r
-    to by s1, until n characters in all have been written.\r
-\r
-    @return   The strncpy function returns the value of s1.\r
-**/\r
-char     *strncpy(char * __restrict s1, const char * __restrict s2, size_t n)\r
-{\r
-  return AsciiStrnCpy( s1, s2, n);\r
-  //char *dest = s1;\r
-\r
-  //while(n != 0) {\r
-  //  --n;\r
-  //  if((*dest++ = *s2++) == '\0')  break;\r
-  //}\r
-  //while(n != 0) {\r
-  //  *dest++ = '\0';\r
-  //  --n;\r
-  //}\r
-  //return (s1);\r
-}\r
-\r
-/** The strncpyX function copies not more than n-1 characters (characters that\r
-    follow a null character are not copied) from the array pointed to by s2 to\r
-    the array pointed to by s1. Array s1 is guaranteed to be NULL terminated.\r
-    If copying takes place between objects that overlap,\r
-    the behavior is undefined.\r
-\r
-    strncpyX exists because normal strncpy does not indicate if the copy was\r
-    terminated because of exhausting the buffer or reaching the end of s2.\r
-\r
-    @return   The strncpyX function returns 0 if the copy operation was\r
-              terminated because it reached the end of s1.  Otherwise,\r
-              a non-zero value is returned indicating how many characters\r
-              remain in s1.\r
-**/\r
-int strncpyX(char * __restrict s1, const char * __restrict s2, size_t n)\r
-{\r
-  int NumLeft;\r
-\r
-  for( ; n != 0; --n) {\r
-    if((*s1++ = *s2++) == '\0')  break;\r
-  }\r
-  NumLeft = (int)n;\r
-\r
-  for( --s1; n != 0; --n) {\r
-    *s1++ = '\0';\r
-  }\r
-\r
-  return NumLeft;   // Zero if we ran out of buffer ( strlen(s1) < strlen(s2) )\r
-}\r
-\r
-/** NetBSD Compatibility Function strdup creates a duplicate copy of a string. **/\r
-char *\r
-strdup(const char *str)\r
-{\r
-  size_t len;\r
-  char *copy;\r
-\r
-  len = strlen(str) + 1;\r
-  if ((copy = malloc(len)) == NULL)\r
-    return (NULL);\r
-  memcpy(copy, str, len);\r
-  return (copy);\r
-}\r