[Rpm-maint] [rpm-software-management/rpm] Fix regression from commit 165330b7bf0757e30fa8a6de9998a564fb62796f (#1545)

Demi Marie Obenour notifications at github.com
Thu Feb 18 20:41:46 UTC 2021


@DemiMarie commented on this pull request.

We can use a ternary conditional to make the code a bit shorter.

> @@ -409,7 +409,8 @@ unsigned headerSizeof(Header h, int magicp)
 static inline int strtaglen(const char *str, rpm_count_t c, const char *end)
 {
     const char *start = str;
-    const char *s;
+    const char *s = NULL;
+    int len = -1; /* assume failure */

```suggestion
```

> +    if (s != NULL && c == 0)
+	len = s - str + 1;
+
+    return len;

```suggestion
    return s != NULL && c == 0 ? s - str + 1 : -1;
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1545#pullrequestreview-593626698
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210218/8518c170/attachment.html>


More information about the Rpm-maint mailing list