The following commit has been merged in the master branch:
commit adb64dabac58f3d68ce7cc56daa35d5d21467295
Author: Guillem Jover <[email protected]>
Date:   Tue Feb 5 18:40:00 2013 +0100

    u-a: Use alternative_get_fileset() instead of open-coding it

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 0f38095..e873610 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1197,12 +1197,10 @@ alternative_parse_fileset(struct alternative *a, struct 
altdb_context *ctx)
                return false;
        }
 
-       for (fs = a->choices; fs; fs = fs->next) {
-               if (strcmp(fs->master_file, master_file) == 0) {
-                       free(master_file);
-                       ctx->bad_format(ctx, _("duplicate path %s"),
-                                       fs->master_file);
-               }
+       fs = alternative_get_fileset(a, master_file);
+       if (fs) {
+               free(master_file);
+               ctx->bad_format(ctx, _("duplicate path %s"), master_file);
        }
 
        if (stat(master_file, &st)) {
@@ -1600,12 +1598,11 @@ alternative_select_choice(struct alternative *a)
                        }
                } else {
                        /* Look up by name */
-                       for (fs = a->choices; fs; fs = fs->next) {
-                               if (strcmp(fs->master_file, selection) == 0) {
-                                       alternative_set_status(a, 
ALT_ST_MANUAL);
-                                       free(current);
-                                       return xstrdup(selection);
-                               }
+                       fs = alternative_get_fileset(a, selection);
+                       if (fs) {
+                               alternative_set_status(a, ALT_ST_MANUAL);
+                               free(current);
+                               return xstrdup(selection);
                        }
                }
        }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to