Changeset 4790
- Timestamp:
- 09/06/07 14:22:59 (6 years ago)
- Location:
- lm-sensors/trunk/lib
- Files:
-
- 1 added
- 2 modified
-
conf-parse.y (modified) (6 diffs)
-
init.c (modified) (2 diffs)
-
init.h (added)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/lib/conf-parse.y
r4788 r4790 30 30 #include "conf.h" 31 31 #include "access.h" 32 #include "init.h" 32 33 33 34 static void sensors_yyerror(const char *err); … … 73 74 sizeof(sensors_chip_name)); 74 75 75 /* YYERROR can only be called in rules, not in other functions, so this must76 be a macro */77 #define check_current_chip()\78 do { if (! current_chip) {\79 sensors_yyerror("Label, Set or Compute statement before first chip statement");\80 YYERROR;\81 }\82 } while (0)83 84 76 %} 85 77 … … 161 153 label_statement: LABEL function_name string 162 154 { sensors_label new_el; 163 check_current_chip(); 155 if (!current_chip) { 156 sensors_yyerror("Label statement before first chip statement"); 157 free($2); 158 free($3); 159 YYERROR; 160 } 164 161 new_el.lineno = $1; 165 162 new_el.name = $2; … … 171 168 set_statement: SET function_name expression 172 169 { sensors_set new_el; 173 check_current_chip(); 170 if (!current_chip) { 171 sensors_yyerror("Set statement before first chip statement"); 172 free($2); 173 free_expr($3); 174 YYERROR; 175 } 174 176 new_el.lineno = $1; 175 177 new_el.name = $2; … … 181 183 compute_statement: COMPUTE function_name expression ',' expression 182 184 { sensors_compute new_el; 183 check_current_chip(); 185 if (!current_chip) { 186 sensors_yyerror("Compute statement before first chip statement"); 187 free($2); 188 free_expr($3); 189 free_expr($5); 190 YYERROR; 191 } 184 192 new_el.lineno = $1; 185 193 new_el.name = $2; … … 192 200 ignore_statement: IGNORE function_name 193 201 { sensors_ignore new_el; 194 check_current_chip(); 202 if (!current_chip) { 203 sensors_yyerror("Ignore statement before first chip statement"); 204 free($2); 205 YYERROR; 206 } 195 207 new_el.lineno = $1; 196 208 new_el.name = $2; -
lm-sensors/trunk/lib/init.c
r4546 r4790 28 28 #include "sysfs.h" 29 29 #include "scanner.h" 30 #include "init.h" 30 31 31 32 static void free_proc_chips_entry(sensors_proc_chips_entry entry); … … 37 38 static void free_compute(sensors_compute compute); 38 39 static void free_ignore(sensors_ignore ignore); 39 static void free_expr(sensors_expr *expr);40 40 41 41 int sensors_init(FILE *input)
