some CEXEBuild::doParse cleanup

- removed last_line_had_slash which was always set to zero
 - moved m_linebuild.resize(0) so it won't free the memory the next condition uses, though the line needs to be 64kb for that to happen
 - took care of a coupple of comments


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4842 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-12-09 13:08:05 +00:00
parent 62007bdd5b
commit 4ca1f6d04b

View file

@ -279,31 +279,34 @@ int CEXEBuild::doParse(const char *str)
while (*str == ' ' || *str == '\t') str++;
if (m_linebuild.getlen()>1) m_linebuild.resize(m_linebuild.getlen()-2);
// remove trailing slash and null, if there's a previous line
if (m_linebuild.getlen()>1)
m_linebuild.resize(m_linebuild.getlen()-2);
m_linebuild.add(str,strlen(str)+1);
// remove trailing slash and null
if (str[0] && CharPrev(str,str+strlen(str))[0] == '\\') {
last_line_had_slash = 1;
// keep waiting for more lines, if this line ends with a backslash
if (str[0] && CharPrev(str,str+strlen(str))[0] == '\\')
return PS_OK;
}
else last_line_had_slash = 0;
// parse before checking if the line should be ignored, so block comments won't be missed
res=line.parse((char*)m_linebuild.get(),!strnicmp((char*)m_linebuild.get(),"!define",7));
inside_comment = line.InCommentBlock();
m_linebuild.resize(0);
// if ignoring, ignore all lines that don't begin with an exclamation mark
{
bool ignore_line = cur_ifblock && (cur_ifblock->ignore || cur_ifblock->inherited_ignore);
char first_char = *(char *) m_linebuild.get();
if (ignore_line && first_char!='!' && !last_line_had_slash)
if (ignore_line && first_char!='!')
{
m_linebuild.resize(0);
return PS_OK;
}
}
m_linebuild.resize(0);
if (res)
{
if (res==-2) ERROR_MSG("Error: unterminated string parsing line at %s:%d\n",curfilename,linecnt);