[Haiku-commits] r31072 - haiku/trunk/src/apps/debugger

bonefish at mail.berlios.de bonefish at mail.berlios.de
Tue Jun 16 23:42:03 CEST 2009


Author: bonefish
Date: 2009-06-16 23:41:59 +0200 (Tue, 16 Jun 2009)
New Revision: 31072
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31072&view=rev

Modified:
   haiku/trunk/src/apps/debugger/Array.h
Log:
Added Clear()/MakeEmpty() methods.


Modified: haiku/trunk/src/apps/debugger/Array.h
===================================================================
--- haiku/trunk/src/apps/debugger/Array.h	2009-06-16 21:22:10 UTC (rev 31071)
+++ haiku/trunk/src/apps/debugger/Array.h	2009-06-16 21:41:59 UTC (rev 31072)
@@ -25,6 +25,9 @@
 	inline	bool				Insert(const Element& element, int index);
 	inline	bool				Remove(int index);
 
+			void				Clear();
+	inline	void				MakeEmpty();
+
 	inline	Element&			ElementAt(int index);
 	inline	const Element&		ElementAt(int index) const;
 
@@ -120,6 +123,29 @@
 
 
 template<typename Element>
+void
+Array<Element>::Clear()
+{
+	if (fSize == 0)
+		return;
+
+	free(fElements);
+
+	fElements = NULL;
+	fSize = 0;
+	fCapacity = 0;
+}
+
+
+template<typename Element>
+void
+Array<Element>::MakeEmpty()
+{
+	Clear();
+}
+
+
+template<typename Element>
 Element&
 Array<Element>::ElementAt(int index)
 {




More information about the Haiku-commits mailing list