/[jscoverage]/trunk/instrument.c
ViewVC logotype

Diff of /trunk/instrument.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 87 by siliconforks, Mon May 5 20:05:27 2008 UTC revision 92 by siliconforks, Wed May 7 04:21:22 2008 UTC
# Line 165  Line 165 
165        {        {
166          FILE * input = xfopen(source_file, "r");          FILE * input = xfopen(source_file, "r");
167          FILE * output = xfopen(destination_file, "w");          FILE * output = xfopen(destination_file, "w");
168          const char * suffix = ".jscoverage.js";  
169          char temporary_file_name[strlen(destination_file) + strlen(suffix) + 1];          Stream * input_stream = Stream_new(0);
170          strcpy(temporary_file_name, destination_file);          Stream * output_stream = Stream_new(0);
171          strcat(temporary_file_name, suffix);  
172          jscoverage_instrument_js(id, input, output, temporary_file_name);          Stream_write_file_contents(input_stream, input);
173    
174            jscoverage_instrument_js(id, input_stream, output_stream);
175    
176            if (fwrite(output_stream->data, 1, output_stream->length, output) != output_stream->length) {
177              fatal("cannot write to file: %s", destination_file);
178            }
179    
180            Stream_delete(input_stream);
181            Stream_delete(output_stream);
182    
183          fclose(input);          fclose(input);
184          fclose(output);          fclose(output);
185        }        }

Legend:
Removed from v.87  
changed lines
  Added in v.92

  ViewVC Help
Powered by ViewVC 1.1.24