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() {
|
File::~File() {
|
||||||
close(fd);
|
close(fd);
|
||||||
setBufferSize(0);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::setBufferSize(size_t size) {
|
void File::setBufferSize(size_t size) {
|
||||||
|
14
ZString.cpp
14
ZString.cpp
@ -66,8 +66,10 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZString::~ZString() {
|
ZString::~ZString() {
|
||||||
if(cdata != NULL)
|
if(cdata != NULL) {
|
||||||
free(cdata);
|
std::cout << "********" << cdata << "********" << strlen(cdata) << std::endl;
|
||||||
|
free(cdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZString::operator<(const ZString &valuex) const {
|
bool ZString::operator<(const ZString &valuex) const {
|
||||||
@ -443,8 +445,12 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ZString::skipWhitespace() {
|
int ZString::skipWhitespace() {
|
||||||
int len = strspn(cursor, " \n\t");
|
char *end = data + length;
|
||||||
cursor += len;
|
int len = 0;
|
||||||
|
while((cursor < end) && ((*cursor == ' ') || (*cursor == '\n') || (*cursor == '\t'))) {
|
||||||
|
++cursor;
|
||||||
|
++len;
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ namespace coreutils {
|
|||||||
/// Destructor for the ZString.
|
/// Destructor for the ZString.
|
||||||
///
|
///
|
||||||
|
|
||||||
~ZString();
|
virtual ~ZString();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A friend method used to write the value of the ZString
|
/// A friend method used to write the value of the ZString
|
||||||
@ -454,9 +454,9 @@ namespace coreutils {
|
|||||||
void moveBackToLineStart();
|
void moveBackToLineStart();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char *data;
|
char *data = NULL;
|
||||||
char *cursor;
|
char *cursor = NULL;
|
||||||
size_t length;
|
size_t length = 0;
|
||||||
char *cdata = NULL;
|
char *cdata = NULL;
|
||||||
std::vector<ZString> list;
|
std::vector<ZString> list;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user