cleanup for valgrind.
This commit is contained in:
parent
e5bfd7a840
commit
0ebe8eaf5b
2
File.cpp
2
File.cpp
@ -34,7 +34,7 @@ namespace coreutils {
|
||||
|
||||
File::~File() {
|
||||
close(fd);
|
||||
setBufferSize(0);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
void File::setBufferSize(size_t size) {
|
||||
|
12
ZString.cpp
12
ZString.cpp
@ -66,9 +66,11 @@ namespace coreutils {
|
||||
}
|
||||
|
||||
ZString::~ZString() {
|
||||
if(cdata != NULL)
|
||||
if(cdata != NULL) {
|
||||
std::cout << "********" << cdata << "********" << strlen(cdata) << std::endl;
|
||||
free(cdata);
|
||||
}
|
||||
}
|
||||
|
||||
bool ZString::operator<(const ZString &valuex) const {
|
||||
char *end1 = data + length;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace coreutils {
|
||||
/// Destructor for the ZString.
|
||||
///
|
||||
|
||||
~ZString();
|
||||
virtual ~ZString();
|
||||
|
||||
///
|
||||
/// A friend method used to write the value of the ZString
|
||||
@ -454,9 +454,9 @@ namespace coreutils {
|
||||
void moveBackToLineStart();
|
||||
|
||||
protected:
|
||||
char *data;
|
||||
char *cursor;
|
||||
size_t length;
|
||||
char *data = NULL;
|
||||
char *cursor = NULL;
|
||||
size_t length = 0;
|
||||
char *cdata = NULL;
|
||||
std::vector<ZString> list;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user