File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11#include  "leptjson.h" 
22#include  <assert.h>   /* assert() */ 
33#include  <stdlib.h>   /* NULL, strtod() */ 
4- #include  <string.h> 
54#include  <math.h> 
65#define  EXPECT (c , ch )       do { assert(*c->json == (ch)); c->json++; } while(0)
76#define  ISDIGIT (ch )         ((ch) >= '0' && (ch) <= '9')
@@ -20,12 +19,17 @@ static void lept_parse_whitespace(lept_context* c) {
2019
2120static  int  lept_parse_literal (lept_context *  c , lept_value *  v , 
2221                              const  char *  json , int  type ) {
23-     int   i ,  len   =   strlen ( json ) ;
24-     for ( i   =   0 ;  i   <   len ;  ++ i ) {
22+     size_t   i   =   0 ;
23+     while ( json [ i ] ) {
2524        if (c -> json [i ] !=  json [i ]) return  LEPT_PARSE_INVALID_VALUE ;
25+         ++ i ;
2626    }
27+                                   /* 
28+     for(i = 0; i < len; ++i) { 
29+         if(c->json[i] != json[i]) return LEPT_PARSE_INVALID_VALUE; 
30+     }*/ 
2731    v -> type  =  type ;
28-     c -> json  +=  len ;
32+     c -> json  +=  i ;
2933    return  LEPT_PARSE_OK ;
3034}
3135
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments