[Rpm-maint] [rpm-software-management/rpm] Add "local_generator" (PR #2734)

Florian Festi notifications at github.com
Tue Feb 13 16:14:02 UTC 2024


@ffesti commented on this pull request.



>      if (rpmGlob(attrPath, NULL, &files) == 0) {
-	nattrs = argvCount(files);
-	fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes));
-	for (int i = 0; i < nattrs; i++) {
-	    char *bn = basename(files[i]);
-	    bn[strlen(bn)-strlen(".attr")] = '\0';
-	    fc->atypes[i] = rpmfcAttrNew(bn);
-	}
-	fc->atypes[nattrs] = NULL;
-	argvFree(files);
+	nfiles = argvCount(files);
+    }
+    for (int i = 0; i < nfiles; i++) {
+	char *bn = basename(files[i]);
+	bn[strlen(bn)-strlen(".attr")] = '\0';
+	argvAddUniq(&all_attrs, bn);

Yes, but they are file names and not just attribute names. An while they are unique because we hard coded the glob, making the location configurable may turn up the same names from different locations. That's why I made the code a bit more defensive than it needs to be. Also I don't even want to think what rpmGlob returns if it doesn't find anything. Overall I don't think this is going to get that much simpler in the end.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2734#discussion_r1488176745
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2734/review/1878400062 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240213/6b31ca84/attachment.html>


More information about the Rpm-maint mailing list