]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Deal with missing repos in testcase_mangle_repo_names
authorMichael Schroeder <mls@suse.de>
Mon, 5 Oct 2020 08:11:23 +0000 (10:11 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 5 Oct 2020 08:11:23 +0000 (10:11 +0200)
Also simplify the code a bit.

ext/testcase.c

index bbed5ab02dd529097f6b7b564395b4b19fb1fb43..0f537f70d22d5f570e47ed149d1e26e1a28da0e1 100644 (file)
@@ -1826,14 +1826,12 @@ testcase_mangle_repo_names(Pool *pool)
       for (mp = buf; *mp; mp++)
        if (*mp == ' ' || *mp == '\t' || *mp == '/')
          *mp = '_';
-      for (;;)
-       {
-         for (i = 1; i < repoid; i++)
-           if (!strcmp(buf, names[i]))
-             break;
-         if (i == repoid)
-           break;
+      for (i = 1; i < repoid; i++)
+        {
+         if (!names[i] || strcmp(buf, names[i]) != 0)
+           continue;
           sprintf(mp, "_%d", mangle++);
+         i = 0;        /* restart conflict check */
        }
       names[repoid] = buf;
     }