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.


sprintf configuration fixes
[palacios.git] / palacios / src / palacios / vmm_sprintf.c
index b48e657..c1ca717 100644 (file)
 #include <palacios/vmm_sprintf.h>
 
 
-#define NEED_SPRINTF 0
-#define NEED_SNPRINTF 0
-#define NEED_VSPRINTF 0
-#define NEED_VSNPRINTF 0
-#define NEED_VSNRPRINTF 1
 
 
 typedef addr_t ptrdiff_t;     /* ptr1 - ptr2 */
@@ -91,12 +86,20 @@ struct snprintf_arg {
 };
 
 
+
+#if defined(CONFIG_BUILT_IN_STDIO) &&                \
+    ( defined(CONFIG_BUILT_IN_SPRINTF) ||            \
+      defined(CONFIG_BUILT_IN_SNPRINTF) ||           \
+      defined(CONFIG_BUILT_IN_VSPRINTF) ||           \
+      defined(CONFIG_BUILT_IN_VSNPRINTF) ||          \
+      defined(CONFIG_BUILT_IN_VSNRPRINTF ))
+
 static char * ksprintn(char * nbuf, uint64_t num, int base, int *len, int upper);
 static void snprintf_func(int ch, void * arg);
 static int kvprintf(char const * fmt, void (*func)(int, void *), void * arg, int radix, va_list ap);
 
 
-#if NEED_SPRINTF
+#ifdef CONFIG_BUILT_IN_SPRINTF
 /*
  * Scaled down version of sprintf(3).
  */
@@ -113,7 +116,7 @@ int sprintf(char * buf, const char * cfmt, ...) {
 #endif 
 
 
-#if NEED_VSPRINTF
+#ifdef CONFIG_BUILT_IN_VSPRINTF
 /*
  * Scaled down version of vsprintf(3).
  */
@@ -127,7 +130,7 @@ int vsprintf(char * buf, const char * cfmt, va_list ap) {
 #endif
 
 
-#if NEED_SNPRINTF
+#ifdef CONFIG_BUILT_IN_SNPRINTF
 /*
  * Scaled down version of snprintf(3).
  */
@@ -143,7 +146,7 @@ int snprintf(char * str, size_t size, const char * format, ...) {
 #endif
 
 
-#if NEED_VSNPRINTF 
+#ifdef CONFIG_BUILT_IN_VSNPRINTF 
 /*
  * Scaled down version of vsnprintf(3).
  */
@@ -162,7 +165,7 @@ int vsnprintf(char * str, size_t size, const char * format, va_list ap) {
 #endif 
 
 
-#if NEED_VSNRPRINTF
+#ifdef CONFIG_BUILT_IN_VSNRPRINTF
 /*
  * Kernel version which takes radix argument vsnprintf(3).
  */
@@ -550,6 +553,8 @@ number:
 }
 
 
+#endif // CONFIG_BUILT_IN_STDIO
+
 
 
 void v3_hexdump(const void * ptr, int length, const char * hdr, int flags) {