[vmkit-commits] [vmkit] r83709 - in /vmkit/trunk: include/mvm/PrintBuffer.h include/mvm/UTF8.h lib/JnJVM/VMCore/UTF8.h

Gael Thomas gael.thomas at lip6.fr
Sat Oct 10 04:54:43 PDT 2009


Author: gthomas
Date: Sat Oct 10 06:54:43 2009
New Revision: 83709

URL: http://llvm.org/viewvc/llvm-project?rev=83709&view=rev
Log:
Remove the useless UTF8Buffer from mvm. Define UTF8Buffer in Jnjvm for compatibility. It inherits from mvm::PrintBuffer


Modified:
    vmkit/trunk/include/mvm/PrintBuffer.h
    vmkit/trunk/include/mvm/UTF8.h
    vmkit/trunk/lib/JnJVM/VMCore/UTF8.h

Modified: vmkit/trunk/include/mvm/PrintBuffer.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/PrintBuffer.h?rev=83709&r1=83708&r2=83709&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/PrintBuffer.h (original)
+++ vmkit/trunk/include/mvm/PrintBuffer.h Sat Oct 10 06:54:43 2009
@@ -152,6 +152,14 @@
 		obj->print(this);
 		return this;
 	}
+
+
+  /// replaceWith - replace the content of the buffer and free the old buffer
+  ///
+	void replaceWith(char *buffer) {
+		delete[] this->contents;
+		this->contents = buffer;
+	}
 };
 
 } // end namespace mvm

Modified: vmkit/trunk/include/mvm/UTF8.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/UTF8.h?rev=83709&r1=83708&r2=83709&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/UTF8.h (original)
+++ vmkit/trunk/include/mvm/UTF8.h Sat Oct 10 06:54:43 2009
@@ -134,48 +134,6 @@
 	}
 };
 
-/// UTF8Buffer - Helper class to create char* buffers suitable for
-/// printf.
-///
-class UTF8Buffer {
-
-  /// buffer - The buffer that holds a string representation.
-  ///
-  char* buffer;
-public:
-
-  /// UTF8Buffer - Create a buffer with the following UTF8.
-  ///
-  UTF8Buffer(const UTF8* val) {
-    buffer = new char[val->size + 1];
-    for (sint32 i = 0; i < val->size; ++i)
-      buffer[i] = val->elements[i];
-    buffer[val->size] = 0;
-  }
-
-  /// ~UTF8Buffer - Delete the buffer, as well as all dynamically
-  /// allocated memory.
-  ///
-  ~UTF8Buffer() {
-    delete[] buffer;
-  }
-
-  /// replaceWith - replace the content of the buffer and free the old buffer
-  ///
-	void replaceWith(char *buffer) {
-		delete[] this->buffer;
-		this->buffer = buffer;
-	}
-
-
-  /// cString - Return a C string representation of the buffer, suitable
-  /// for printf.
-  ///
-  const char* cString() {
-    return buffer;
-  }
-};
-
 } // end namespace mvm
 
 #endif

Modified: vmkit/trunk/lib/JnJVM/VMCore/UTF8.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/UTF8.h?rev=83709&r1=83708&r2=83709&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/UTF8.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/UTF8.h Sat Oct 10 06:54:43 2009
@@ -4,6 +4,7 @@
 #include "types.h"
 
 #include "mvm/UTF8.h"
+#include "mvm/PrintBuffer.h"
 
 namespace jnjvm {
 	using mvm::UTF8;
@@ -12,10 +13,10 @@
 /// UTF8Buffer - Helper class to create char* buffers suitable for
 /// printf.
 ///
-class UTF8Buffer : public mvm::UTF8Buffer {
+class UTF8Buffer : public mvm::PrintBuffer {
 public:
   /// UTF8Buffer - Create a buffer with the following UTF8.
-  UTF8Buffer(const UTF8* val) : mvm::UTF8Buffer(val) {}
+  UTF8Buffer(const UTF8* val) : mvm::PrintBuffer(val) {}
 
   /// toCompileName - Change the utf8 following JNI conventions.
   ///





More information about the vmkit-commits mailing list