]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
write_config update to parse_kconfig changes
authorKarel Kočí <cynerd@email.cz>
Fri, 1 May 2015 19:13:45 +0000 (21:13 +0200)
committerKarel Kočí <cynerd@email.cz>
Fri, 1 May 2015 19:13:45 +0000 (21:13 +0200)
scripts/write_config/solution.c
scripts/write_config/solution.h
scripts/write_config/symlist.c
scripts/write_config/symlist.h
scripts/write_config/write.c

index 5a82a011fa04d1fb5aa41a72c2c0000014affa20..a8d9fc756f9084a5f343abb546060f1810a4ec11 100644 (file)
@@ -1,6 +1,6 @@
 #include "solution.h"
 
-void solution_set(struct symlist *sl, FILE * f) {
+void solution_check(struct symlist *sl, FILE * f) {
     int c;
     // skip first line
     do
@@ -22,6 +22,8 @@ void solution_set(struct symlist *sl, FILE * f) {
                 ww = w + 1;
             }
             int id = atoi(ww);
+            if ((unsigned) id > sl->maxid)
+                break;
             if (id == 0)
                 continue;
             if (sl->array[id - 1].sym == NULL)
index fb1ebed769a1cb602dad3987d52646122f499e09..91db619e73df1e463c3e73ea63a79cbc4f69656b 100644 (file)
@@ -8,6 +8,6 @@
 #ifndef _SOLUTION_H_
 #define _SOLUTION_H_
 
-void solution_set(struct symlist *sl, FILE * f);
+void solution_check(struct symlist *sl, FILE * f);
 
 #endif /* _SOLUTION_H_ */
index e0e7a1fc12bb04d1d98ab603ae92cc229c4cb146..fd0aca80a560935a4dc6479fd6c3f6322a8a4b87 100644 (file)
@@ -6,6 +6,7 @@ struct symlist *symlist_read(FILE * f) {
     struct symlist *ret;
     ret = malloc(sizeof(struct symlist));
     ret->size = 1;
+    ret->maxid = 0;
     ret->array = malloc(ret->size * sizeof(struct symlist_el));
 
     unsigned int id;
@@ -24,6 +25,8 @@ struct symlist *symlist_read(FILE * f) {
                     realloc(ret->array,
                             ret->size * sizeof(struct symlist_el));
             }
+            if (id > ret->maxid)
+                ret->maxid = id;
             ret->array[(size_t) id - 1].id = id;
             if (!strncmp(w, NONAMEGEN, strlen(NONAMEGEN)))
                 ret->array[(size_t) id - 1].sym = NULL;
index 3736b2b7ecc9fed6ac74a0847d2c8c2da2751d82..8bc61c168627fedd9abd655b14145fc52d24f972 100644 (file)
@@ -15,6 +15,7 @@ struct symlist_el {
 struct symlist {
     struct symlist_el *array;
     size_t size;
+    unsigned maxid;
 };
 
 struct symlist *symlist_read(FILE *f);
index 4bec6aab1d19464d232997f4d01f4142bfb3b846..86895b685fe2489b6a8dd9fbea5a2a94f448a49d 100644 (file)
@@ -63,7 +63,7 @@ int main(int argc, char **argv) {
         Eprintf("Can't open file: %s\n", solution_file);
         exit(2);
     }
-    solution_set(sl, f);
+    solution_check(sl, f);
     fclose(f);
 
     conf_write(".config");