@@ -751,40 +751,41 @@ void assemblefile(const char * filename)
751
751
int startif=numif;
752
752
if (!filecontents.exists (absolutepath))
753
753
{
754
- char * temp= readfile (absolutepath, " " );
754
+ char * temp = readfile (absolutepath, " " );
755
755
if (!temp)
756
756
{
757
757
asar_throw_error (0 , error_type_null, vfile_error_to_error_id (asar_get_last_io_error ()), filename);
758
758
759
759
return ;
760
760
}
761
- file.contents =split (temp, ' \n ' );
762
- file.data = temp;
763
- for (int i=0 ;file.contents [i];i++)
761
+ sourcefile& newfile = filecontents.create (absolutepath);
762
+ newfile.contents =split (temp, ' \n ' );
763
+ newfile.data = temp;
764
+ for (int i=0 ;newfile.contents [i];i++)
764
765
{
765
- file .numlines ++;
766
- char * line= file .contents [i];
766
+ newfile .numlines ++;
767
+ char * line= newfile .contents [i];
767
768
char * comment = strqchr (line, ' ;' );
768
769
if (comment) *comment = 0 ;
769
770
if (!confirmquotes (line)) { callstack_push cs_push (callstack_entry_type::LINE, line, i); asar_throw_error (0 , error_type_null, error_id_mismatched_quotes); line[0 ] = ' \0 ' ; }
770
- file .contents [i] = strip_whitespace (line);
771
+ newfile .contents [i] = strip_whitespace (line);
771
772
}
772
- for (int i=0 ;file .contents [i];i++)
773
+ for (int i=0 ;newfile .contents [i];i++)
773
774
{
774
- char * line = file .contents [i];
775
+ char * line = newfile .contents [i];
775
776
if (!*line) continue ;
776
- for (int j=1 ;line[strlen (line) - 1 ] == ' ,' && file .contents [i+j];j++)
777
+ for (int j=1 ;line[strlen (line) - 1 ] == ' ,' && newfile .contents [i+j];j++)
777
778
{
778
779
// not using strcat because the source and dest overlap here
779
- char * otherline = file .contents [i+j];
780
+ char * otherline = newfile .contents [i+j];
780
781
char * line_end = line + strlen (line);
781
782
while (*otherline) *line_end++ = *otherline++;
782
783
*line_end = ' \0 ' ;
783
784
static char nullstr[]=" " ;
784
- file .contents [i+j]=nullstr;
785
+ newfile .contents [i+j]=nullstr;
785
786
}
786
787
}
787
- filecontents. create (absolutepath) = file ;
788
+ file = newfile ;
788
789
} else { // filecontents.exists(absolutepath)
789
790
file = filecontents.find (absolutepath);
790
791
}
0 commit comments