diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-12 14:22:35 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-12 14:22:35 +0200 |
| commit | c90f6b27e5fe229a69a20f4a4fc453bb6e787e90 (patch) | |
| tree | bf740a60a65d5e33d7e4ee64a0837599f7e99771 | |
| parent | 4e4f9e871236067f0cda4b67a732d3b3bbf08884 (diff) | |
MHR-23: Add tls_delete_class function.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
| -rw-r--r-- | Kernel/FSKit/IndexableProperty.hxx | 2 | ||||
| -rw-r--r-- | Kernel/FSKit/NewFS.hxx | 1 | ||||
| -rw-r--r-- | Kernel/KernelKit/ThreadLocalStorage.inl | 20 |
3 files changed, 18 insertions, 5 deletions
diff --git a/Kernel/FSKit/IndexableProperty.hxx b/Kernel/FSKit/IndexableProperty.hxx index eae15317..28ea230a 100644 --- a/Kernel/FSKit/IndexableProperty.hxx +++ b/Kernel/FSKit/IndexableProperty.hxx @@ -10,7 +10,7 @@ #include <CompilerKit/CompilerKit.hxx> #include <KernelKit/DriveManager.hxx> -#define kIndexerNodeNameLength 256 +#define kIndexerNodeNameLength 255 #define kIndexerClaimed 0xCF namespace NewOS diff --git a/Kernel/FSKit/NewFS.hxx b/Kernel/FSKit/NewFS.hxx index dca7aa2c..acb22798 100644 --- a/Kernel/FSKit/NewFS.hxx +++ b/Kernel/FSKit/NewFS.hxx @@ -209,7 +209,6 @@ namespace NewOS /// \brief NewFS parser class. (catalog creation, remove removal, root, /// forks...) Designed like the DOM, detects the filesystem automatically. /// - class NewFSParser final { public: diff --git a/Kernel/KernelKit/ThreadLocalStorage.inl b/Kernel/KernelKit/ThreadLocalStorage.inl index ae3277eb..6407900f 100644 --- a/Kernel/KernelKit/ThreadLocalStorage.inl +++ b/Kernel/KernelKit/ThreadLocalStorage.inl @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright SoftwareLabs + Copyright SoftwareLabs ------------------------------------------- */ @@ -34,12 +34,15 @@ inline bool tls_delete_ptr(T* ptr) MUST_PASS(ProcessScheduler::Shared().Leak().GetCurrent()); - ptr->~T(); - auto ref_process = ProcessScheduler::Shared().Leak().GetCurrent(); return ref_process.Leak().Delete(ptr, sizeof(T)); } +/// @brief Allocate a C++ class, and then call the constructor of it. +/// @tparam T +/// @tparam ...Args +/// @param ...args +/// @return template <typename T, typename... Args> T* tls_new_class(Args&&... args) { @@ -53,3 +56,14 @@ T* tls_new_class(Args&&... args) return nullptr; } + +/// @brief Delete a C++ class (call constructor first.) +/// @tparam T +/// @param ptr +/// @return +template <typename T> +inline bool tls_delete_class(T* ptr) +{ + ptr->~T(); + return tls_delete_ptr(ptr); +}
\ No newline at end of file |
