X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_string.c;h=af912b4d9bd63805f57b96854caff3dc6545d234;hb=56f8088296ee4116a4811a2f4f843edd80a7748d;hp=ecc08a84d2e3eaa9c54b96adfe6ca2f27581963e;hpb=a109eb919a162bd7de58d62020801bc2e633be50;p=palacios.releases.git diff --git a/palacios/src/palacios/vmm_string.c b/palacios/src/palacios/vmm_string.c index ecc08a8..af912b4 100644 --- a/palacios/src/palacios/vmm_string.c +++ b/palacios/src/palacios/vmm_string.c @@ -1,12 +1,17 @@ /* * String library * Copyright (c) 2001,2004 David H. Hovemeyer - * $Revision: 1.1 $ + * (c) 2008, Jack Lange + * (c) 2008, The V3VEE Project + * $Revision: 1.2 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". */ + + + /* * NOTE: * These are slow and simple implementations of a subset of @@ -16,9 +21,20 @@ #include +#include + + -extern void *Malloc(size_t size); +static float e = 0.00000001; +double ceil(double x) { + if ((double)(x - (int)x) == 0) { + return (int)x; + } + return (int)(x + e) + 1; +} + +#if 0 void* memset(void* s, int c, size_t n) { unsigned char* p = (unsigned char*) s; @@ -31,6 +47,7 @@ void* memset(void* s, int c, size_t n) return s; } + void* memcpy(void *dst, const void* src, size_t n) { unsigned char* d = (unsigned char*) dst; @@ -44,6 +61,7 @@ void* memcpy(void *dst, const void* src, size_t n) return dst; } + int memcmp(const void *s1_, const void *s2_, size_t n) { const signed char *s1 = s1_, *s2 = s2_; @@ -152,7 +170,7 @@ char *strdup(const char *s1) { char *ret; - ret = Malloc(strlen(s1) + 1); + ret = V3_Malloc(strlen(s1) + 1); strcpy(ret, s1); return ret; @@ -210,3 +228,4 @@ char *strpbrk(const char *s, const char *accept) return 0; } +#endif