commit f7aada98359c9fd7b575e326187fc35e02a9da76
parent 2f64aeb31b8f4e9d17a3dccb09a069d15c2a7325
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date: Thu, 24 Sep 2020 12:34:21 +1000
axe useless parens in conditionals
Diffstat:
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/bsdiff.c b/bsdiff.c
@@ -139,23 +139,23 @@ main(int argc, char **argv)
newsize - scan, 0, oldsize, &pos);
for (; scsc < scan + len; scsc++)
- if ((scsc + lastoffset < oldsize) &&
- (old[scsc + lastoffset] == new[scsc]))
+ if (scsc + lastoffset < oldsize &&
+ old[scsc + lastoffset] == new[scsc])
oldscore++;
- if (((len == oldscore) && (len != 0)) ||
- (len > oldscore + 8))
+ if ((len == oldscore && len != 0) ||
+ len > oldscore + 8)
break;
- if ((scan + lastoffset < oldsize) &&
- (old[scan + lastoffset] == new[scan]))
+ if (scan + lastoffset < oldsize &&
+ old[scan + lastoffset] == new[scan])
oldscore--;
}
- if ((len != oldscore) || (scan == newsize)) {
+ if (len != oldscore || scan == newsize) {
s = Sf = lenf = 0;
- for (i = 0; (lastscan + i < scan) &&
- (lastpos + i < oldsize);) {
+ for (i = 0; lastscan + i < scan &&
+ lastpos + i < oldsize;) {
if (old[lastpos + i] == new[lastscan + i])
s++;
i++;
@@ -169,7 +169,7 @@ main(int argc, char **argv)
if (scan < newsize) {
s = Sb = 0;
for (i = 1;
- (scan >= lastscan + i) && (pos >= i);
+ scan >= lastscan + i && pos >= i;
i++) {
if (old[pos - i] == new[scan - i])
s++;
@@ -184,8 +184,7 @@ main(int argc, char **argv)
overlap = (lastscan + lenf) - (scan - lenb);
s = Ss = lens = 0;
for (i = 0; i < overlap; i++) {
- if (new[lastscan + lenf - overlap +
- i] ==
+ if (new[lastscan + lenf - overlap + i] ==
old[lastpos + lenf - overlap + i])
s++;
if (new[scan - lenb + i] ==
diff --git a/bspatch.c b/bspatch.c
@@ -167,7 +167,7 @@ main(int argc, char **argv)
}
/* Sanity-check */
- if ((ctrl[0] < 0) || (ctrl[1] < 0))
+ if (ctrl[0] < 0 || ctrl[1] < 0)
errx(1, "Corrupt patch");
/* Sanity-check */
@@ -176,13 +176,13 @@ main(int argc, char **argv)
/* Read diff string */
lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
- if ((lenread < ctrl[0]) ||
- ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
+ if (lenread < ctrl[0] ||
+ (dbz2err != BZ_OK && dbz2err != BZ_STREAM_END))
errx(1, "Corrupt patch");
/* Add old data to diff string */
for (i = 0; i < ctrl[0]; i++)
- if ((oldpos + i >= 0) && (oldpos + i < oldsize))
+ if (oldpos + i >= 0 && oldpos + i < oldsize)
new[newpos + i] += old[oldpos + i];
/* Adjust pointers */
@@ -195,8 +195,8 @@ main(int argc, char **argv)
/* Read extra string */
lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
- if ((lenread < ctrl[1]) ||
- ((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
+ if (lenread < ctrl[1] ||
+ (ebz2err != BZ_OK && ebz2err != BZ_STREAM_END))
errx(1, "Corrupt patch");
/* Adjust pointers */