Move most headers containing generic template classes out of kernel/util.

This follows on the move of BitUtils. Many of these headers were
already used in userspace.

Fixes #19849.
This commit is contained in:
Augustin Cavalier
2025-12-09 16:11:46 -05:00
parent 9f786b6af7
commit 1257e2ba22
34 changed files with 18 additions and 171 deletions
@@ -1 +0,0 @@
#include <../private/kernel/util/BumpAllocator.h>
@@ -1 +0,0 @@
#include <../private/kernel/util/DoublyLinkedList.h>
@@ -1 +0,0 @@
#include <../private/kernel/util/OpenHashTable.h>
@@ -1 +0,0 @@
#include <../private/kernel/util/SinglyLinkedList.h>
@@ -0,0 +1 @@
#include <../private/util/BumpAllocator.h>
@@ -0,0 +1 @@
#include <../private/util/DoublyLinkedList.h>
@@ -0,0 +1 @@
#include <../private/util/OpenHashTable.h>
@@ -0,0 +1 @@
#include <../private/util/SinglyLinkedList.h>
+1 -1
View File
@@ -6,8 +6,8 @@
#ifndef HASH_MAP_H
#define HASH_MAP_H
#include <OpenHashTable.h>
#include <Locker.h>
#include <util/OpenHashTable.h>
#include "AutoLocker.h"
+1 -1
View File
@@ -6,8 +6,8 @@
#ifndef HASH_SET_H
#define HASH_SET_H
#include <OpenHashTable.h>
#include <Locker.h>
#include <util/OpenHashTable.h>
#include "AutoLocker.h"
-1
View File
@@ -1 +0,0 @@
#include <../kernel/util/OpenHashTable.h>
@@ -11,9 +11,10 @@
#include <lock.h>
#include <string.h>
#include <util/SplayTree.h>
#include "DirectoryIterator.h"
#include "exfat.h"
#include "SplayTree.h"
#include "Volume.h"
@@ -1,6 +1,5 @@
SubDir HAIKU_TOP src add-ons kernel file_systems exfat ;
UsePrivateHeaders [ FDirName kernel util ] ;
UsePrivateHeaders shared storage ;
UsePrivateHeaders file_systems ;
UsePrivateKernelHeaders ;
@@ -16,4 +15,4 @@ KernelAddon exfat :
;
SEARCH on [ FGristFiles DeviceOpener.cpp ]
= [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ;
= [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ;
@@ -18,9 +18,9 @@
#include <string.h>
#include <StorageDefs.h>
#include <util/SplayTree.h>
#include "exfat.h"
#include "SplayTree.h"
struct node_key {
@@ -9,7 +9,7 @@
#include <image.h>
#include <OS.h>
#include <kernel/util/DoublyLinkedList.h>
#include <util/DoublyLinkedList.h>
#include "FSCapabilities.h"
#include "Locker.h"
@@ -8,7 +8,7 @@
#include <fs_interface.h>
#include <SupportDefs.h>
#include <kernel/util/DoublyLinkedList.h>
#include <util/DoublyLinkedList.h>
#include "FSCapabilities.h"
+1 -2
View File
@@ -6,12 +6,11 @@
#define RTF_H
#include "Stack.h"
#include <List.h>
#include <String.h>
#include <GraphicsDefs.h>
#include <BufferIO.h>
#include <util/Stack.h>
namespace RTF {
-70
View File
@@ -1,70 +0,0 @@
/* Stack - a template stack class
*
* Copyright 2001-2005, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License.
*/
#ifndef STACK_H
#define STACK_H
#include <stdlib.h>
#include <SupportDefs.h>
template<class T> class Stack {
public:
Stack()
:
fArray(NULL),
fUsed(0),
fMax(0)
{
}
~Stack()
{
free(fArray);
}
bool IsEmpty() const
{
return fUsed == 0;
}
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 */
-2
View File
@@ -23,8 +23,6 @@
#include <AutoDeleter.h>
#include "Stack.h"
#define READ_BUFFER_SIZE 2048
+1 -1
View File
@@ -14,8 +14,8 @@
#include <Locker.h>
#include <String.h>
#include <kernel/util/DoublyLinkedList.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
class BBitmap;
-79
View File
@@ -1,79 +0,0 @@
/* Stack - a template stack class (plus some handy methods)
*
* Copyright 2001-2005, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License.
*/
#ifndef KERNEL_UTIL_STACK_H
#define KERNEL_UTIL_STACK_H
#include <SupportDefs.h>
#include <stdlib.h>
template<class T> class Stack {
public:
Stack()
:
fArray(NULL),
fUsed(0),
fMax(0)
{
}
~Stack()
{
free(fArray);
}
bool IsEmpty() const
{
return fUsed == 0;
}
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;
}
T *Array()
{
return fArray;
}
int32 CountItems() const
{
return fUsed;
}
private:
T *fArray;
int32 fUsed;
int32 fMax;
};
#endif /* KERNEL_UTIL_STACK_H */
+2 -2
View File
@@ -3,11 +3,11 @@
* Distributed under the terms of the MIT License.
*/
#include "SudokuSolver.h"
#include <util/Stack.h>
#include "SudokuField.h"
#include "Stack.h"
struct SolutionStep {
+1 -1
View File
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src kits media ;
AddResources libmedia.so : libmedia.rdef ;
UsePrivateHeaders app media kernel shared ;
UsePrivateHeaders app media shared ;
UsePrivateHeaders [ FDirName media experimental ] ;
UsePrivateHeaders [ FDirName interface ] ;
+1 -1
View File
@@ -19,7 +19,7 @@
#include <OS.h>
#include <locks.h>
#include <kernel/util/DoublyLinkedList.h>
#include <util/DoublyLinkedList.h>
//#define TRACE_RTM