am c380385f: Merge "Fix LP64 builds after OpenBSD string changes."

* commit 'c380385f0b8826ab7c02429dd48b07670516f964':
  Fix LP64 builds after OpenBSD string changes.
This commit is contained in:
Elliott Hughes 2014-02-25 23:21:55 +00:00 committed by Android Git Automerger
commit 6c7935408e
4 changed files with 18 additions and 10 deletions
libc

View File

@ -5,7 +5,7 @@ libc_common_src_files_arm64 := \
bionic/memchr.c \ bionic/memchr.c \
bionic/__memcmp16.cpp \ bionic/__memcmp16.cpp \
bionic/memcmp.c \ bionic/memcmp.c \
bionic/memcpy.c \ bionic/memcpy.cpp \
bionic/memmove.c \ bionic/memmove.c \
bionic/memrchr.c \ bionic/memrchr.c \
bionic/memset.c \ bionic/memset.c \

View File

@ -4,7 +4,7 @@ libc_common_src_files_x86_64 := \
bionic/index.cpp \ bionic/index.cpp \
bionic/memchr.c \ bionic/memchr.c \
bionic/memcmp.c \ bionic/memcmp.c \
bionic/memcpy.c \ bionic/memcpy.cpp \
bionic/memmove.c \ bionic/memmove.c \
bionic/memrchr.c \ bionic/memrchr.c \
bionic/memset.c \ bionic/memset.c \

View File

@ -31,14 +31,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stddef.h> #include <stddef.h>
// Unoptimized version of __memcmp16. // Unoptimized version of __memcmp16.
int __memcmp16(const unsigned short *ptr1, const unsigned short *ptr2, size_t n) { extern "C" int __memcmp16(const unsigned short* lhs, const unsigned short* rhs, size_t n) {
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
if (*ptr1 != *ptr2) { if (*lhs != *rhs) {
return *ptr1 - *ptr2; return *lhs - *rhs;
} }
ptr1++; lhs++;
ptr2++; rhs++;
} }
return 0; return 0;
} }

View File

@ -25,5 +25,14 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#define MEMCOPY
#include "bcopy.c" #undef _FORTIFY_SOURCE
#include <string.h>
#include <strings.h>
// Our unoptimized memcpy just calls the best bcopy available.
// (It's this way round rather than the opposite because we're based on BSD source.)
void* memcpy(void* dst, const void* src, size_t n) {
bcopy(src, dst, n);
return dst;
}