Przeglądaj źródła

Use named initializers in structures

Guillem Jover 16 lat temu
rodzic
commit
977648880d
4 zmienionych plików z 35 dodań i 23 usunięć
  1. 1 1
      lib/dpkg/buffer.c
  2. 6 6
      lib/dpkg/parsehelp.c
  3. 3 3
      lib/dpkg/triglib.c
  4. 25 13
      src/enquiry.c

+ 1 - 1
lib/dpkg/buffer.c

@@ -198,7 +198,7 @@ buffer_copy_TYPE(PtrPtr, void *, ptr, void *, ptr);
 off_t
 buffer_hash(const void *input, void *output, int type, off_t limit)
 {
-	struct buffer_data data = { { output }, type };
+	struct buffer_data data = { .arg.ptr = output, .type = type };
 	off_t ret;
 
 	buffer_init(NULL, &data);

+ 6 - 6
lib/dpkg/parsehelp.c

@@ -154,12 +154,12 @@ const char *illegal_packagename(const char *p, const char **ep) {
 
 const struct nickname nicknames[]= {
   /* NB: capitalisation of these strings is important. */
-  { "Recommended",       "Recommends"  },
-  { "Optional",          "Suggests"    },
-  { "Class",             "Priority"    },
-  { "Package-Revision",  "Revision"    },
-  { "Package_Revision",  "Revision"    },
-  {  NULL                              }
+  { .nick = "Recommended",      .canon = "Recommends" },
+  { .nick = "Optional",         .canon = "Suggests" },
+  { .nick = "Class",            .canon = "Priority" },
+  { .nick = "Package-Revision", .canon = "Revision" },
+  { .nick = "Package_Revision", .canon = "Revision" },
+  { .nick = NULL }
 };
 
 int informativeversion(const struct versionrevision *version) {

+ 3 - 3
lib/dpkg/triglib.c

@@ -711,9 +711,9 @@ tdm_incorp_trig_end(void)
 }
 
 static const struct trigdefmeths tdm_incorp = {
-	tdm_incorp_trig_begin,
-	tdm_incorp_package,
-	tdm_incorp_trig_end
+	.trig_begin = tdm_incorp_trig_begin,
+	.package = tdm_incorp_package,
+	.trig_end = tdm_incorp_trig_end
 };
 
 void

+ 25 - 13
src/enquiry.c

@@ -65,37 +65,49 @@ bsyn_status(struct pkginfo *pkg, const struct badstatinfo *bsi)
 
 static const struct badstatinfo badstatinfos[]= {
   {
-    bsyn_reinstreq, 0,
-    N_("The following packages are in a mess due to serious problems during\n"
+    .yesno = bsyn_reinstreq,
+    .value = 0,
+    .explanation = N_(
+    "The following packages are in a mess due to serious problems during\n"
     "installation.  They must be reinstalled for them (and any packages\n"
     "that depend on them) to function properly:\n")
   }, {
-    bsyn_status, stat_unpacked,
-    N_("The following packages have been unpacked but not yet configured.\n"
+    .yesno = bsyn_status,
+    .value = stat_unpacked,
+    .explanation = N_(
+    "The following packages have been unpacked but not yet configured.\n"
     "They must be configured using dpkg --configure or the configure\n"
     "menu option in dselect for them to work:\n")
   }, {
-    bsyn_status, stat_halfconfigured,
-    N_("The following packages are only half configured, probably due to problems\n"
+    .yesno = bsyn_status,
+    .value = stat_halfconfigured,
+    .explanation = N_(
+    "The following packages are only half configured, probably due to problems\n"
     "configuring them the first time.  The configuration should be retried using\n"
     "dpkg --configure <package> or the configure menu option in dselect:\n")
   }, {
-    bsyn_status, stat_halfinstalled,
-    N_("The following packages are only half installed, due to problems during\n"
+    .yesno = bsyn_status,
+    .value = stat_halfinstalled,
+    .explanation = N_(
+    "The following packages are only half installed, due to problems during\n"
     "installation.  The installation can probably be completed by retrying it;\n"
     "the packages can be removed using dselect or dpkg --remove:\n")
   }, {
-    bsyn_status, stat_triggersawaited,
-    N_("The following packages are awaiting processing of triggers that they\n"
+    .yesno = bsyn_status,
+    .value = stat_triggersawaited,
+    .explanation = N_(
+    "The following packages are awaiting processing of triggers that they\n"
     "have activated in other packages.  This processing can be requested using\n"
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
   }, {
-    bsyn_status, stat_triggerspending,
-    N_("The following packages have been triggered, but the trigger processing\n"
+    .yesno = bsyn_status,
+    .value = stat_triggerspending,
+    .explanation = N_(
+    "The following packages have been triggered, but the trigger processing\n"
     "has not yet been done.  Trigger processing can be requested using\n"
     "dselect or dpkg --configure --pending (or dpkg --triggers-only):\n")
   }, {
-    NULL
+    .yesno = NULL
   }
 };