mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(string): add SStrDupA
This commit is contained in:
parent
d3f3c10aa5
commit
399e3f02d6
3 changed files with 25 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "storm/String.hpp"
|
||||
#include "storm/Error.hpp"
|
||||
#include "storm/Memory.hpp"
|
||||
#include "storm/string/bjhash.hpp"
|
||||
#include <cstring>
|
||||
#include <strings.h>
|
||||
|
|
@ -171,6 +172,14 @@ size_t SStrCopy(char* dest, const char* source, size_t destsize) {
|
|||
return static_cast<size_t>(destbuf - dest);
|
||||
}
|
||||
|
||||
char* SStrDupA(const char* string, const char* filename, uint32_t linenumber) {
|
||||
size_t len = SStrLen(string) + 1;
|
||||
char* dup = static_cast<char*>(SMemAlloc(len, filename, linenumber, 0x0));
|
||||
memcpy(dup, string, len);
|
||||
|
||||
return dup;
|
||||
}
|
||||
|
||||
uint32_t SStrHashHT(const char* string) {
|
||||
char normalized[0x400];
|
||||
char* buf = normalized;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue