2010-09-21 Craig Howland <howland@LGSInnovations.com>
* libc/string/memcpy.c: Do not assign size_t parameter to int.
        Use parameter directly, instead.
        * libc/string/memccpy.c:  Likewise.
        * libc/string/mempcpy.c:  Likewise.
        * libc/string/memmove.c:  Likewise.
			
			
This commit is contained in:
		| @@ -1,3 +1,11 @@ | |||||||
|  | 2010-09-21  Craig Howland <howland@LGSInnovations.com> | ||||||
|  |  | ||||||
|  | 	* libc/string/memcpy.c: Do not assign size_t parameter to int. | ||||||
|  | 	Use parameter directly, instead. | ||||||
|  | 	* libc/string/memccpy.c:  Likewise. | ||||||
|  | 	* libc/string/mempcpy.c:  Likewise. | ||||||
|  | 	* libc/string/memmove.c:  Likewise. | ||||||
|  |  | ||||||
| 2010-09-09  Kevin Buettner  <kevinb@redhat.com> | 2010-09-09  Kevin Buettner  <kevinb@redhat.com> | ||||||
|  |  | ||||||
| 	* libc/sys/sysnecv850/Makefile.am (lib_a_SOURCES): Provide an | 	* libc/sys/sysnecv850/Makefile.am (lib_a_SOURCES): Provide an | ||||||
|   | |||||||
| @@ -92,12 +92,11 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0), | |||||||
|   _CONST char *src = src0; |   _CONST char *src = src0; | ||||||
|   long *aligned_dst; |   long *aligned_dst; | ||||||
|   _CONST long *aligned_src; |   _CONST long *aligned_src; | ||||||
|   int   len =  len0; |  | ||||||
|   char endchar = endchar0 & 0xff; |   char endchar = endchar0 & 0xff; | ||||||
|  |  | ||||||
|   /* If the size is small, or either SRC or DST is unaligned, |   /* If the size is small, or either SRC or DST is unaligned, | ||||||
|      then punt into the byte copy loop.  This should be rare.  */ |      then punt into the byte copy loop.  This should be rare.  */ | ||||||
|   if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) |   if (!TOO_SMALL(len0) && !UNALIGNED (src, dst)) | ||||||
|     { |     { | ||||||
|       int i; |       int i; | ||||||
|       unsigned long mask = 0; |       unsigned long mask = 0; | ||||||
| @@ -116,14 +115,14 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0), | |||||||
|  |  | ||||||
|  |  | ||||||
|       /* Copy one long word at a time if possible.  */ |       /* Copy one long word at a time if possible.  */ | ||||||
|       while (len >= LITTLEBLOCKSIZE) |       while (len0 >= LITTLEBLOCKSIZE) | ||||||
|         { |         { | ||||||
|           unsigned long buffer = (unsigned long)(*aligned_src); |           unsigned long buffer = (unsigned long)(*aligned_src); | ||||||
|           buffer ^=  mask; |           buffer ^=  mask; | ||||||
|           if (DETECTNULL (buffer)) |           if (DETECTNULL (buffer)) | ||||||
|             break; /* endchar is found, go byte by byte from here */ |             break; /* endchar is found, go byte by byte from here */ | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           len -= LITTLEBLOCKSIZE; |           len0 -= LITTLEBLOCKSIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|        /* Pick up any residual with a byte copier.  */ |        /* Pick up any residual with a byte copier.  */ | ||||||
| @@ -131,7 +130,7 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0), | |||||||
|       src = (char*)aligned_src; |       src = (char*)aligned_src; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   while (len--) |   while (len0--) | ||||||
|     { |     { | ||||||
|       if ((*dst++ = *src++) == endchar) |       if ((*dst++ = *src++) == endchar) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -72,30 +72,29 @@ _DEFUN (memcpy, (dst0, src0, len0), | |||||||
|   _CONST char *src = src0; |   _CONST char *src = src0; | ||||||
|   long *aligned_dst; |   long *aligned_dst; | ||||||
|   _CONST long *aligned_src; |   _CONST long *aligned_src; | ||||||
|   int   len =  len0; |  | ||||||
|  |  | ||||||
|   /* If the size is small, or either SRC or DST is unaligned, |   /* If the size is small, or either SRC or DST is unaligned, | ||||||
|      then punt into the byte copy loop.  This should be rare.  */ |      then punt into the byte copy loop.  This should be rare.  */ | ||||||
|   if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) |   if (!TOO_SMALL(len0) && !UNALIGNED (src, dst)) | ||||||
|     { |     { | ||||||
|       aligned_dst = (long*)dst; |       aligned_dst = (long*)dst; | ||||||
|       aligned_src = (long*)src; |       aligned_src = (long*)src; | ||||||
|  |  | ||||||
|       /* Copy 4X long words at a time if possible.  */ |       /* Copy 4X long words at a time if possible.  */ | ||||||
|       while (len >= BIGBLOCKSIZE) |       while (len0 >= BIGBLOCKSIZE) | ||||||
|         { |         { | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           len -= BIGBLOCKSIZE; |           len0 -= BIGBLOCKSIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       /* Copy one long word at a time if possible.  */ |       /* Copy one long word at a time if possible.  */ | ||||||
|       while (len >= LITTLEBLOCKSIZE) |       while (len0 >= LITTLEBLOCKSIZE) | ||||||
|         { |         { | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           len -= LITTLEBLOCKSIZE; |           len0 -= LITTLEBLOCKSIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|        /* Pick up any residual with a byte copier.  */ |        /* Pick up any residual with a byte copier.  */ | ||||||
| @@ -103,7 +102,7 @@ _DEFUN (memcpy, (dst0, src0, len0), | |||||||
|       src = (char*)aligned_src; |       src = (char*)aligned_src; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   while (len--) |   while (len0--) | ||||||
|     *dst++ = *src++; |     *dst++ = *src++; | ||||||
|  |  | ||||||
|   return dst0; |   return dst0; | ||||||
|   | |||||||
| @@ -88,14 +88,13 @@ _DEFUN (memmove, (dst_void, src_void, length), | |||||||
|   _CONST char *src = src_void; |   _CONST char *src = src_void; | ||||||
|   long *aligned_dst; |   long *aligned_dst; | ||||||
|   _CONST long *aligned_src; |   _CONST long *aligned_src; | ||||||
|   int   len =  length; |  | ||||||
|  |  | ||||||
|   if (src < dst && dst < src + len) |   if (src < dst && dst < src + length) | ||||||
|     { |     { | ||||||
|       /* Destructive overlap...have to copy backwards */ |       /* Destructive overlap...have to copy backwards */ | ||||||
|       src += len; |       src += length; | ||||||
|       dst += len; |       dst += length; | ||||||
|       while (len--) |       while (length--) | ||||||
| 	{ | 	{ | ||||||
| 	  *--dst = *--src; | 	  *--dst = *--src; | ||||||
| 	} | 	} | ||||||
| @@ -105,26 +104,26 @@ _DEFUN (memmove, (dst_void, src_void, length), | |||||||
|       /* Use optimizing algorithm for a non-destructive copy to closely  |       /* Use optimizing algorithm for a non-destructive copy to closely  | ||||||
|          match memcpy. If the size is small or either SRC or DST is unaligned, |          match memcpy. If the size is small or either SRC or DST is unaligned, | ||||||
|          then punt into the byte copy loop.  This should be rare.  */ |          then punt into the byte copy loop.  This should be rare.  */ | ||||||
|       if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) |       if (!TOO_SMALL(length) && !UNALIGNED (src, dst)) | ||||||
|         { |         { | ||||||
|           aligned_dst = (long*)dst; |           aligned_dst = (long*)dst; | ||||||
|           aligned_src = (long*)src; |           aligned_src = (long*)src; | ||||||
|  |  | ||||||
|           /* Copy 4X long words at a time if possible.  */ |           /* Copy 4X long words at a time if possible.  */ | ||||||
|           while (len >= BIGBLOCKSIZE) |           while (length >= BIGBLOCKSIZE) | ||||||
|             { |             { | ||||||
|               *aligned_dst++ = *aligned_src++; |               *aligned_dst++ = *aligned_src++; | ||||||
|               *aligned_dst++ = *aligned_src++; |               *aligned_dst++ = *aligned_src++; | ||||||
|               *aligned_dst++ = *aligned_src++; |               *aligned_dst++ = *aligned_src++; | ||||||
|               *aligned_dst++ = *aligned_src++; |               *aligned_dst++ = *aligned_src++; | ||||||
|               len -= BIGBLOCKSIZE; |               length -= BIGBLOCKSIZE; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|           /* Copy one long word at a time if possible.  */ |           /* Copy one long word at a time if possible.  */ | ||||||
|           while (len >= LITTLEBLOCKSIZE) |           while (length >= LITTLEBLOCKSIZE) | ||||||
|             { |             { | ||||||
|               *aligned_dst++ = *aligned_src++; |               *aligned_dst++ = *aligned_src++; | ||||||
|               len -= LITTLEBLOCKSIZE; |               length -= LITTLEBLOCKSIZE; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|           /* Pick up any residual with a byte copier.  */ |           /* Pick up any residual with a byte copier.  */ | ||||||
| @@ -132,7 +131,7 @@ _DEFUN (memmove, (dst_void, src_void, length), | |||||||
|           src = (char*)aligned_src; |           src = (char*)aligned_src; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       while (len--) |       while (length--) | ||||||
|         { |         { | ||||||
|           *dst++ = *src++; |           *dst++ = *src++; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -69,30 +69,29 @@ _DEFUN (mempcpy, (dst0, src0, len0), | |||||||
|   _CONST char *src = src0; |   _CONST char *src = src0; | ||||||
|   long *aligned_dst; |   long *aligned_dst; | ||||||
|   _CONST long *aligned_src; |   _CONST long *aligned_src; | ||||||
|   int   len =  len0; |  | ||||||
|  |  | ||||||
|   /* If the size is small, or either SRC or DST is unaligned, |   /* If the size is small, or either SRC or DST is unaligned, | ||||||
|      then punt into the byte copy loop.  This should be rare.  */ |      then punt into the byte copy loop.  This should be rare.  */ | ||||||
|   if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) |   if (!TOO_SMALL(len0) && !UNALIGNED (src, dst)) | ||||||
|     { |     { | ||||||
|       aligned_dst = (long*)dst; |       aligned_dst = (long*)dst; | ||||||
|       aligned_src = (long*)src; |       aligned_src = (long*)src; | ||||||
|  |  | ||||||
|       /* Copy 4X long words at a time if possible.  */ |       /* Copy 4X long words at a time if possible.  */ | ||||||
|       while (len >= BIGBLOCKSIZE) |       while (len0 >= BIGBLOCKSIZE) | ||||||
|         { |         { | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           len -= BIGBLOCKSIZE; |           len0 -= BIGBLOCKSIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       /* Copy one long word at a time if possible.  */ |       /* Copy one long word at a time if possible.  */ | ||||||
|       while (len >= LITTLEBLOCKSIZE) |       while (len0 >= LITTLEBLOCKSIZE) | ||||||
|         { |         { | ||||||
|           *aligned_dst++ = *aligned_src++; |           *aligned_dst++ = *aligned_src++; | ||||||
|           len -= LITTLEBLOCKSIZE; |           len0 -= LITTLEBLOCKSIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|        /* Pick up any residual with a byte copier.  */ |        /* Pick up any residual with a byte copier.  */ | ||||||
| @@ -100,7 +99,7 @@ _DEFUN (mempcpy, (dst0, src0, len0), | |||||||
|       src = (char*)aligned_src; |       src = (char*)aligned_src; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   while (len--) |   while (len0--) | ||||||
|     *dst++ = *src++; |     *dst++ = *src++; | ||||||
|  |  | ||||||
|   return dst; |   return dst; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user