@pmatilai commented on this pull request.


> +         return p->token;
+       }
+    }
+    return NULL;
+}
+
+static const int partBeforeBuildOnly(int part)
+{
+    const struct PartRec *p;
+
+    for (p = partList; p->token != NULL; p++) {
+       if (p->part == part) {
+           return p->beforebuildonly;
+       }
+    }
+    return 0;

Oh, I see you mentioned this below. isPart() is a different matter, but .. 

Once you have 

```
static const struct PartRec * getPart(int part);
```

...the check becomes something like:

```
        if (stage == PARSE_GENERATED) {
            const struct PartRec *p = getPart(parsePart);
            if (p && p->prebuildonly) {
                rpmlog(RPMLOG_ERR,
                        _("Section %s is not allowed after build is done!\n"),
                        p->token);
                goto errxit;
            }
        }   
```

...and at that point you realize this whole if belongs into a separate helper 
function that checks whether the tag was legitimate for use here. 
parseSpecSection() is big enough as it is.

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

Message ID: <rpm-software-management/rpm/pull/2917/review/1919652...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to