@@ -172,6 +172,7 @@ static int DelTree(const char* path)
172172/*-------------------------------------------------------------------------*/
173173/* Searchs through the source directory (and its subdirectories) and calls */
174174/* function "xcopy_file" for every found file. */
175+ /* Note: can use up to 40 bytes stack per call with Borland C */
175176/*-------------------------------------------------------------------------*/
176177static int CopyTree (int depth , char * src_pathname ,
177178 const char * src_filename ,
@@ -181,11 +182,10 @@ static int CopyTree(int depth, char *src_pathname,
181182 char * old_new_src_pathname = src_pathname + strlen (src_pathname );
182183 char * old_new_dest_pathname = dest_pathname + strlen (dest_pathname );
183184 /* Warning: these are overwritten during recursive calls */
184- static char filepattern [MAXPATH ],
185+ static char path_pattern_buf [MAXPATH ],
185186 src_path_filename [MAXPATH ],
186187 dest_path_filename [MAXPATH ],
187- tmp_filename [MAXFILE + MAXEXT ],
188- tmp_pathname [MAXPATH ];
188+ tmp_filename [MAXFILE + MAXEXT ];
189189 struct ffblk * fileblock ;
190190 unsigned fileattrib ;
191191 int done ;
@@ -195,9 +195,9 @@ static int CopyTree(int depth, char *src_pathname,
195195 error (1 ,30 ,"Insufficient memory" );
196196 return 0 ;
197197 }
198- strmcpy (filepattern , src_pathname , sizeof (filepattern ));
199- strmcat (filepattern , src_filename , sizeof (filepattern ));
200- done = findfirst (filepattern , fileblock , FA_DIREC );
198+ strmcpy (path_pattern_buf , src_pathname , sizeof (path_pattern_buf ));
199+ strmcat (path_pattern_buf , src_filename , sizeof (path_pattern_buf ));
200+ done = findfirst (path_pattern_buf , fileblock , FA_DIREC );
201201 while (!done )
202202 {
203203 if (fileblock -> ff_attrib == FA_DIREC &&
@@ -226,16 +226,16 @@ static int CopyTree(int depth, char *src_pathname,
226226 fileattrib = FA_RDONLY + FA_ARCH + FA_HIDDEN + FA_SYSTEM ;
227227
228228 /* find first source file */
229- strmcpy (filepattern , src_pathname , sizeof (filepattern ));
230- strmcat (filepattern , src_filename , sizeof (filepattern ));
231- done = findfirst (filepattern , fileblock , fileattrib );
229+ strmcpy (path_pattern_buf , src_pathname , sizeof (path_pattern_buf ));
230+ strmcat (path_pattern_buf , src_filename , sizeof (path_pattern_buf ));
231+ done = findfirst (path_pattern_buf , fileblock , fileattrib );
232232
233233 /* check if destination directory must be created */
234234 if (!dir_exists (dest_pathname ))
235235 {
236- strmcpy (tmp_pathname , dest_pathname , sizeof (tmp_pathname ));
236+ strmcpy (path_pattern_buf , dest_pathname , sizeof (path_pattern_buf ));
237237
238- if (makedir (tmp_pathname ) != 0 )
238+ if (makedir (path_pattern_buf ) != 0 )
239239 {
240240 error (1 ,28 ,"Unable to create directory" );
241241 return 0 ;
0 commit comments