Added a function to dump some debug details about the TString.

This commit is contained in:
2022-06-30 22:24:13 -05:00
parent 3564c43ff4
commit 0874579e92
3 changed files with 15 additions and 83 deletions
+8 -3
View File
@@ -1,7 +1,4 @@
#include "tstring.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
int GetGlyphByteWidth(const char* glyph);
void TStringCopyGlyph(const char* glyph, int length, TString* string);
@@ -140,4 +137,12 @@ void TStringCopyGlyph(const char* glyph, int length, TString* string) {
string->ByteCount += length;
string->Length++;
}
void TStringPrintDetails(const TString* string) {
if (!string) return;
printf("Length: %d Size: %d byte(s) Capacity: %d bytes\n", string->Length, string->ByteCount, string->Capacity);
printf("%s", TStringGetString(string));
printf("\n");
}