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

Diff of /trunk/instrument-js.c

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

revision 213 by siliconforks, Tue Sep 23 03:49:01 2008 UTC revision 214 by siliconforks, Fri Oct 3 02:26:04 2008 UTC
# Line 50  Line 50 
50  */  */
51  static const char * file_id = NULL;  static const char * file_id = NULL;
52  static char * lines = NULL;  static char * lines = NULL;
53    static uint16_t num_lines = 0;
54    
55  void jscoverage_init(void) {  void jscoverage_init(void) {
56    runtime = JS_NewRuntime(8L * 1024L * 1024L);    runtime = JS_NewRuntime(8L * 1024L * 1024L);
# Line 874  Line 875 
875  */  */
876  static void instrument_statement(JSParseNode * node, Stream * f, int indent) {  static void instrument_statement(JSParseNode * node, Stream * f, int indent) {
877    if (node->pn_type != TOK_LC) {    if (node->pn_type != TOK_LC) {
878      int line = node->pn_pos.begin.lineno;      uint16_t line = node->pn_pos.begin.lineno;
879        if (line > num_lines) {
880          fatal("%s: script contains more than 65,535 lines", file_id);
881        }
882    
883      /* the root node has line number 0 */      /* the root node has line number 0 */
884      if (line != 0) {      if (line != 0) {
885        Stream_printf(f, "%*s", indent, "");        Stream_printf(f, "%*s", indent, "");
# Line 918  Line 923 
923    if (node == NULL) {    if (node == NULL) {
924      fatal("parse error in file: %s", file_id);      fatal("parse error in file: %s", file_id);
925    }    }
926    int num_lines = node->pn_pos.end.lineno;    num_lines = node->pn_pos.end.lineno;
927    lines = xmalloc(num_lines);    lines = xmalloc(num_lines);
928    for (int i = 0; i < num_lines; i++) {    for (int i = 0; i < num_lines; i++) {
929      lines[i] = 0;      lines[i] = 0;

Legend:
Removed from v.213  
changed lines
  Added in v.214

  ViewVC Help
Powered by ViewVC 1.1.24