mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 03:02:29 +00:00
chore(string): tidy up code style in CStringManager
This commit is contained in:
parent
69a95ae405
commit
f395a2dc9d
2 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
#include "common/string/CStringManager.hpp"
|
#include "common/string/CStringManager.hpp"
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|
@ -23,8 +22,8 @@ CStringManager::CStringManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* CStringManager::Add(const char* str) {
|
char* CStringManager::Add(const char* str) {
|
||||||
uint32_t hashval = SStrHashHT(str);
|
auto hashval = SStrHashHT(str);
|
||||||
uint32_t bucketIdx = hashval % 0x209;
|
auto bucketIdx = hashval % C_STRING_MANAGER_BUCKETS;
|
||||||
auto bucket = this->m_buckets[bucketIdx];
|
auto bucket = this->m_buckets[bucketIdx];
|
||||||
|
|
||||||
if (bucket) {
|
if (bucket) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "common/string/CStringMemory.hpp"
|
#include "common/string/CStringMemory.hpp"
|
||||||
|
|
||||||
|
#define C_STRING_MANAGER_BUCKETS 521
|
||||||
|
|
||||||
struct CStringElement;
|
struct CStringElement;
|
||||||
|
|
||||||
class CStringManager {
|
class CStringManager {
|
||||||
|
|
@ -14,7 +16,7 @@ class CStringManager {
|
||||||
static CStringManager* Get();
|
static CStringManager* Get();
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
CStringElement* m_buckets[521];
|
CStringElement* m_buckets[C_STRING_MANAGER_BUCKETS];
|
||||||
CStringMemory m_memory;
|
CStringMemory m_memory;
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue