ソースを参照

libdpkg: Generalize f_boolean by not hardcoding to the essential member

Fix the function to use PKGPFIELD to assign to the correct struct
member instead of directly assigning to the essential member. This also
makes this function match its write counterpart w_booleandefno's generic
behaviour.
Guillem Jover 17 年 前
親
コミット
4b9da22956
共有2 個のファイルを変更した、11 個の追加 と 2 個の削除を含む
  1. 5 0
      ChangeLog
  2. 6 2
      lib/fields.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2009-02-27  Guillem Jover  <guillem@debian.org>
+
+	* lib/fields.c (f_boolean): Use PKGPFIELD to assign to the correct
+	member instead of hardcoding to the essential member.
+
 2009-02-27  Guillem Jover  <guillem@debian.org>
 2009-02-27  Guillem Jover  <guillem@debian.org>
 
 
 	* lib/fields.c (f_boolean): Return if value is an empty string.
 	* lib/fields.c (f_boolean): Return if value is an empty string.

+ 6 - 2
lib/fields.c

@@ -130,10 +130,14 @@ void f_boolean(struct pkginfo *pigp, struct pkginfoperfile *pifp,
                enum parsedbflags flags,
                enum parsedbflags flags,
                const char *filename, int lno, FILE *warnto, int *warncount,
                const char *filename, int lno, FILE *warnto, int *warncount,
                const char *value, const struct fieldinfo *fip) {
                const char *value, const struct fieldinfo *fip) {
+  int boolean;
+
   if (!*value)
   if (!*value)
     return;
     return;
-  pifp->essential = convert_string(filename, lno, _("yes/no in boolean field"),
-                                   -1, pigp, value, booleaninfos, NULL);
+
+  boolean = convert_string(filename, lno, _("yes/no in boolean field"),
+                           -1, pigp, value, booleaninfos, NULL);
+  PKGPFIELD(pifp, fip->integer, int) = boolean;
 }
 }
 
 
 void f_section(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 void f_section(struct pkginfo *pigp, struct pkginfoperfile *pifp,