@pmatilai commented on this pull request.


> @@ -80,6 +94,33 @@ static int doShell(rpmSpec spec)
 }
 #endif
 
+static int printSpecAddresses(rpmSpec spec, bool printPatches)
+{
+    SpecSrcIter iter(rpmSpecSrcIterInit(spec));
+    if (!iter) return 1;
+    rpmSpecSrc src;
+    while ((src = rpmSpecSrcIterNext(iter.get())) != NULL) 
+    {
+        bool isPatch = (rpmSpecSrcFlags(src) & RPMBUILD_ISPATCH) != 0;
+
+        if (isPatch == printPatches){
+            const char* url = rpmSpecSrcFilename(src,1);
+            if (url) fprintf(stdout, "%s\n", url);

Testing for NULL here isn't wrong per-se, but it's redundant / perhaps a bit 
misleading: we have a valid iterator here, it cannot return a NULL unless 
there's an internal bug someplace else. 

Static analyzers and the like are eager to splatter NULL-checks every which way 
but I've grown very wary of that over the years - they obfuscate the code and 
the expected semantics to a point where nobody can tell how a thing is 
*supposed to* work.

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

Message ID: <rpm-software-management/rpm/pull/4262/review/[email protected]>
_______________________________________________
Rpm-maint mailing list
[email protected]
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to