Init top-level fstack node line number

It still gets written to the object file, generating Valgrind warnings
about using uninitialized memory. To silence those errors, and make
output more reproducible, init the line no to a dummy (0) value.
This commit is contained in:
ISSOtm
2021-03-25 11:26:58 +01:00
parent e3fde986ad
commit 4216f0a9b0

View File

@@ -539,6 +539,7 @@ void fstk_Init(char const *mainPath, size_t maxRecursionDepth)
context->fileInfo = (struct FileStackNode *)fileInfo; context->fileInfo = (struct FileStackNode *)fileInfo;
/* lineNo and reptIter are unused on the top-level context */ /* lineNo and reptIter are unused on the top-level context */
context->fileInfo->parent = NULL; context->fileInfo->parent = NULL;
context->fileInfo->lineNo = 0; // This still gets written to the object file, so init it
context->fileInfo->referenced = false; context->fileInfo->referenced = false;
context->fileInfo->type = NODE_FILE; context->fileInfo->type = NODE_FILE;
memcpy(fileInfo->name, fileName, len + 1); memcpy(fileInfo->name, fileName, len + 1);