cleanup for valgrind.

This commit is contained in:
barant committed 2024-12-23 11:15:53 -08:00
1 parent e5bfd7a840
commit 0ebe8eaf5b
3 files changed
+15 -9

No files matched your search

+10 -4
View File
@@ -66,8 +66,10 @@ namespace coreutils {
}
ZString::~ZString() {
if(cdata != NULL)
free(cdata);
if(cdata != NULL) {
std::cout << "********" << cdata << "********" << strlen(cdata) << std::endl;
free(cdata);
}
}
bool ZString::operator<(const ZString &valuex) const {
@@ -443,8 +445,12 @@ namespace coreutils {
}
int ZString::skipWhitespace() {
int len = strspn(cursor, " \n\t");
cursor += len;
char *end = data + length;
int len = 0;
while((cursor < end) && ((*cursor == ' ') || (*cursor == '\n') || (*cursor == '\t'))) {
++cursor;
++len;
}
return len;
}