chiark / gitweb /
hwdb: remove support for (not fully implemented) conditional properties
authorKay Sievers <kay@vrfy.org>
Mon, 1 Jul 2013 17:39:50 +0000 (19:39 +0200)
committerKay Sievers <kay@vrfy.org>
Mon, 1 Jul 2013 17:39:50 +0000 (19:39 +0200)
src/libudev/libudev-hwdb.c
src/udev/udevadm-hwdb.c

index a56ad753e45479f673f9c4a01b799362bc306edb..5645a11437c7d100cd1d177e41ef50d30516d7d1 100644 (file)
@@ -140,9 +140,13 @@ static const struct trie_node_f *node_lookup_f(struct udev_hwdb *hwdb, const str
 }
 
 static int hwdb_add_property(struct udev_hwdb *hwdb, const char *key, const char *value) {
 }
 
 static int hwdb_add_property(struct udev_hwdb *hwdb, const char *key, const char *value) {
-        /* TODO: add sub-matches (+) against DMI data */
+        /*
+         * Silently ignore all properties which do not start with a
+         * space; future extensions might use additional prefixes.
+         */
         if (key[0] != ' ')
                 return 0;
         if (key[0] != ' ')
                 return 0;
+
         if (udev_list_entry_add(&hwdb->properties_list, key+1, value) == NULL)
                 return -ENOMEM;
         return 0;
         if (udev_list_entry_add(&hwdb->properties_list, key+1, value) == NULL)
                 return -ENOMEM;
         return 0;
index 3e849aaed6c7eda6e44f68ae7d4529ace5d06484..10b490ee2ba666fcb957538816c68c18541ac96c 100644 (file)
@@ -406,14 +406,12 @@ static int import_file(struct trie *trie, const char *filename) {
         FILE *f;
         char line[LINE_MAX];
         char match[LINE_MAX];
         FILE *f;
         char line[LINE_MAX];
         char match[LINE_MAX];
-        char cond[LINE_MAX];
 
         f = fopen(filename, "re");
         if (f == NULL)
                 return -errno;
 
         match[0] = '\0';
 
         f = fopen(filename, "re");
         if (f == NULL)
                 return -errno;
 
         match[0] = '\0';
-        cond[0] = '\0';
         while (fgets(line, sizeof(line), f)) {
                 size_t len;
 
         while (fgets(line, sizeof(line), f)) {
                 size_t len;
 
@@ -423,7 +421,6 @@ static int import_file(struct trie *trie, const char *filename) {
                 /* new line, new record */
                 if (line[0] == '\n') {
                         match[0] = '\0';
                 /* new line, new record */
                 if (line[0] == '\n') {
                         match[0] = '\0';
-                        cond[0] = '\0';
                         continue;
                 }
 
                         continue;
                 }
 
@@ -436,20 +433,10 @@ static int import_file(struct trie *trie, const char *filename) {
                 /* start of new record */
                 if (match[0] == '\0') {
                         strcpy(match, line);
                 /* start of new record */
                 if (match[0] == '\0') {
                         strcpy(match, line);
-                        cond[0] = '\0';
                         continue;
                 }
 
                         continue;
                 }
 
-                if (line[0] == '+') {
-                        strcpy(cond, line);
-                        continue;
-                }
-
-                /* TODO: support +; skip the entire record until we support it */
-                if (cond[0] != '\0')
-                        continue;
-
-                /* value lines */
+                /* value line */
                 if (line[0] == ' ') {
                         char *value;
 
                 if (line[0] == ' ') {
                         char *value;
 
@@ -459,7 +446,10 @@ static int import_file(struct trie *trie, const char *filename) {
                         value[0] = '\0';
                         value++;
                         trie_insert(trie, trie->root, match, line, value);
                         value[0] = '\0';
                         value++;
                         trie_insert(trie, trie->root, match, line, value);
+                        continue;
                 }
                 }
+
+                log_error("Error parsing line '%s' in '%s\n", line, filename);
         }
         fclose(f);
         return 0;
         }
         fclose(f);
         return 0;