We now use the kernel's Stack class instead of our own copy.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14417 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-10-18 20:03:00 +00:00
parent 0bf62ebece
commit b68efdcaa7
5 changed files with 6 additions and 70 deletions
@@ -12,9 +12,9 @@
#include "BPlusTree.h"
#include "Inode.h"
#include "Utility.h"
#include "Stack.h"
#include <util/kernel_cpp.h>
#include <util/Stack.h>
#include <TypeConstants.h>
#include <string.h>
@@ -10,9 +10,9 @@
#include "Volume.h"
#include "Inode.h"
#include "BPlusTree.h"
#include "Stack.h"
#include "bfs_control.h"
#include <util/Stack.h>
#include <util/kernel_cpp.h>
#include <stdlib.h>
@@ -12,7 +12,6 @@
#include "Query.h"
#include "bfs.h"
#include "Debug.h"
#include "Stack.h"
#include "Volume.h"
#include "Inode.h"
#include "BPlusTree.h"
+4 -4
View File
@@ -7,11 +7,11 @@
#define QUERY_H
#include <SupportDefs.h>
#include "Index.h"
#include "Stack.h"
#include "Chain.h"
#include "Index.h"
#include <util/Stack.h>
#include <SupportDefs.h>
class Volume;
class Term;
@@ -1,63 +0,0 @@
/* Stack - a template stack class
*
* Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
#ifndef STACK_H
#define STACK_H
#include <SupportDefs.h>
template<class T> class Stack {
public:
Stack()
:
fArray(NULL),
fUsed(0),
fMax(0)
{
}
~Stack()
{
free(fArray);
}
void MakeEmpty()
{
// could also free the memory
fUsed = 0;
}
status_t Push(T value)
{
if (fUsed >= fMax) {
fMax += 16;
T *newArray = (T *)realloc(fArray, fMax * sizeof(T));
if (newArray == NULL)
return B_NO_MEMORY;
fArray = newArray;
}
fArray[fUsed++] = value;
return B_OK;
}
bool Pop(T *value)
{
if (fUsed == 0)
return false;
*value = fArray[--fUsed];
return true;
}
private:
T *fArray;
int32 fUsed;
int32 fMax;
};
#endif /* STACK_H */