Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added new copyright and license
[palacios.git] / palacios / src / palacios / vmm_string.c
index ecc08a8..5d0d4fa 100644 (file)
@@ -1,11 +1,32 @@
 /*
- * String library
- * Copyright (c) 2001,2004 David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.1 $
- * 
- * This is free software.  You are permitted to use,
- * redistribute, and modify it as specified in the file "COPYING".
+ * String library 
+ * Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu>
+ * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+ * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+/* Modifications by Jack Lange <jarusl@cs.northwestern.edu> */
+
+
 
 /*
  * NOTE:
 
 
 #include <palacios/vmm_string.h>
+#include <palacios/vmm.h>
+
+
 
-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 +63,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 +77,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 +186,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 +244,4 @@ char *strpbrk(const char *s, const char *accept)
     return 0;
 }
 
+#endif