mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -319,6 +319,9 @@ namespace bx
|
||||
/// Returns string view with suffix trimmed.
|
||||
StringView strTrimSuffix(const StringView& _str, const StringView& _suffix);
|
||||
|
||||
/// Returns string view `_num` from the right.
|
||||
StringView strTail(const StringView _str, uint32_t _num);
|
||||
|
||||
/// Find new line. Returns pointer after new line terminator.
|
||||
StringView strFindNl(const StringView& _str);
|
||||
|
||||
|
||||
@@ -274,22 +274,6 @@ namespace bx
|
||||
return 1;
|
||||
}
|
||||
|
||||
// If offset in UTF-8 string doesn't land on rune, walk back until first byte of rune is reached.
|
||||
static const char* fixPtrToRune(const char* _strBegin, const char* _curr)
|
||||
{
|
||||
for (; _curr > _strBegin && (*_curr & 0xc0) == 0x80; --_curr);
|
||||
|
||||
return _curr;
|
||||
}
|
||||
|
||||
StringView strTail(const StringView _str, uint32_t _num)
|
||||
{
|
||||
return StringView(
|
||||
fixPtrToRune(_str.getPtr(), _str.getTerm() - min(_num, _str.getLength() ) )
|
||||
, _str.getTerm()
|
||||
);
|
||||
}
|
||||
|
||||
int32_t writeCallstack(WriterI* _writer, uintptr_t* _stack, uint32_t _num, Error* _err)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
|
||||
@@ -556,6 +556,22 @@ namespace bx
|
||||
return strLTrimSpace(strRTrimSpace(_str) );
|
||||
}
|
||||
|
||||
// If offset in UTF-8 string doesn't land on rune, walk back until first byte of rune is reached.
|
||||
static const char* fixPtrToRune(const char* _strBegin, const char* _curr)
|
||||
{
|
||||
for (; _curr > _strBegin && (*_curr & 0xc0) == 0x80; --_curr);
|
||||
|
||||
return _curr;
|
||||
}
|
||||
|
||||
StringView strTail(const StringView _str, uint32_t _num)
|
||||
{
|
||||
return StringView(
|
||||
fixPtrToRune(_str.getPtr(), _str.getTerm() - min(_num, _str.getLength() ) )
|
||||
, _str.getTerm()
|
||||
);
|
||||
}
|
||||
|
||||
constexpr uint32_t kFindStep = 1024;
|
||||
|
||||
StringView strFindNl(const StringView& _str)
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
#include <bx/string.h>
|
||||
#include <bx/file.h>
|
||||
|
||||
namespace bx
|
||||
{
|
||||
void debugOutputCallstack(uint32_t _skip);
|
||||
}
|
||||
|
||||
bool testAssertHandler(const bx::Location& _location, const char* _format, va_list _argList)
|
||||
{
|
||||
bx::printf("%s(%d): ", _location.filePath, _location.line);
|
||||
|
||||
Reference in New Issue
Block a user