]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #16057 from keszybz/resolvectl-sorted-no-nta
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jun 2020 02:30:14 +0000 (11:30 +0900)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2020 02:30:14 +0000 (11:30 +0900)
Drop NTA lists from resolvectl status and sort output by link number

1  2 
src/pstore/pstore.c

diff --combined src/pstore/pstore.c
index 59d0b5b74e8b0637afcdff9f688b36821eb34f93,0a6ad21908fe8638a2b381a256d4e279b88cee1c..9b888a2baacdfb89451e4679fd5318cd1b808092
@@@ -78,14 -78,11 +78,14 @@@ static int parse_config(void) 
                  {}
          };
  
 -        return config_parse_many_nulstr(PKGSYSCONFDIR "/pstore.conf",
 -                                        CONF_PATHS_NULSTR("systemd/pstore.conf.d"),
 -                                        "PStore\0",
 -                                        config_item_table_lookup, items,
 -                                        CONFIG_PARSE_WARN, NULL);
 +        return config_parse_many_nulstr(
 +                        PKGSYSCONFDIR "/pstore.conf",
 +                        CONF_PATHS_NULSTR("systemd/pstore.conf.d"),
 +                        "PStore\0",
 +                        config_item_table_lookup, items,
 +                        CONFIG_PARSE_WARN,
 +                        NULL,
 +                        NULL);
  }
  
  /* File list handling - PStoreEntry is the struct and
@@@ -101,8 -98,8 +101,8 @@@ typedef struct PStoreEntry 
  
  typedef struct PStoreList {
          PStoreEntry *entries;
+         size_t n_allocated;
          size_t n_entries;
-         size_t n_entries_allocated;
  } PStoreList;
  
  static void pstore_entries_reset(PStoreList *list) {
          list->n_entries = 0;
  }
  
- static int compare_pstore_entries(const void *_a, const void *_b) {
-         PStoreEntry *a = (PStoreEntry *)_a, *b = (PStoreEntry *)_b;
+ static int compare_pstore_entries(const PStoreEntry *a, const PStoreEntry *b) {
          return strcmp(a->dirent.d_name, b->dirent.d_name);
  }
  
@@@ -349,7 -345,7 +348,7 @@@ static int list_files(PStoreList *list
                          continue;
                  }
  
-                 if (!GREEDY_REALLOC(list->entries, list->n_entries_allocated, list->n_entries + 1))
+                 if (!GREEDY_REALLOC(list->entries, list->n_allocated, list->n_entries + 1))
                          return log_oom();
  
                  list->entries[list->n_entries++] = (PStoreEntry) {
@@@ -394,7 -390,7 +393,7 @@@ static int run(int argc, char *argv[]) 
  
          /* Handle each pstore file */
          /* Sort files lexigraphically ascending, generally needed by all */
-         qsort_safe(list.entries, list.n_entries, sizeof(PStoreEntry), compare_pstore_entries);
+         typesafe_qsort(list.entries, list.n_entries, compare_pstore_entries);
  
          /* Process known file types */
          process_dmesg_files(&list);