]> granicus.if.org Git - graphviz/commitdiff
lib/pathplan/shortest.c: [nfc] separate assignments from conditionals
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 22 Feb 2022 16:17:37 +0000 (08:17 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Feb 2022 07:09:12 +0000 (23:09 -0800)
Squashes a number of MSVC “C4706: assignment within conditional expression”
warnings.

lib/pathplan/shortest.c

index ec20b63b844cfee295efefb3f0390c05b48608ce..8f9bd9a47febb33f15e8d53a89d74f43bfd7ff96 100644 (file)
@@ -502,11 +502,13 @@ static int growpnls(int newpnln)
 {
     if (newpnln <= pnln)
        return 0;
-    if (!(pnls = realloc(pnls, POINTNLINKSIZE * newpnln))) {
+    pnls = realloc(pnls, POINTNLINKSIZE * newpnln);
+    if (pnls == NULL) {
        prerror("cannot realloc pnls");
        return -1;
     }
-    if (!(pnlps = realloc(pnlps, POINTNLINKPSIZE * newpnln))) {
+    pnlps = realloc(pnlps, POINTNLINKPSIZE * newpnln);
+    if (pnlps == NULL) {
        prerror("cannot realloc pnlps");
        return -1;
     }
@@ -518,7 +520,8 @@ static int growtris(int newtrin)
 {
     if (newtrin <= trin)
        return 0;
-    if (!(tris = realloc(tris, TRIANGLESIZE * newtrin))) {
+    tris = realloc(tris, TRIANGLESIZE * newtrin);
+    if (tris == NULL) {
        prerror("cannot realloc tris");
        return -1;
     }
@@ -531,7 +534,8 @@ static int growdq(int newdqn)
 {
     if (newdqn <= dq.pnlpn)
        return 0;
-    if (!(dq.pnlps = realloc(dq.pnlps, POINTNLINKPSIZE * newdqn))) {
+    dq.pnlps = realloc(dq.pnlps, POINTNLINKPSIZE * newdqn);
+    if (dq.pnlps == NULL) {
        prerror("cannot realloc dq.pnls");
        return -1;
     }
@@ -543,7 +547,8 @@ static int growops(int newopn)
 {
     if (newopn <= opn)
        return 0;
-    if (!(ops = realloc(ops, POINTSIZE * newopn))) {
+    ops = realloc(ops, POINTSIZE * newopn);
+    if (ops == NULL) {
        prerror("cannot realloc ops");
        return -1;
     }