edit: Clean up a few assignments within conditionals
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 29 Mar 2013 16:35:50 +0000 (17:35 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:55:03 +0000 (19:55 +0200)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/edit.c

index 9e282e60a17a3c51a3d27ad20ed66834d9c53237..9eb2d09b186a0bd528d1d13243135373199ea16d 100644 (file)
@@ -67,7 +67,7 @@ edit(void)
     char *what;
     char *key, *ptr;
     int num;
-    int err;
+    int ret;
     int arg_index = 3;
     coord x, y;
     struct natstr *np;
@@ -158,38 +158,43 @@ edit(void)
 
        switch (ewhat) {
        case 'c':
-           if ((err = edit_nat(np, key, ptr)) != RET_OK)
-               return err;
+           ret = edit_nat(np, key, ptr);
+           if (ret != RET_OK)
+               return ret;
            break;
        case 'l':
            if (!check_sect_ok(&item.sect))
                return RET_FAIL;
-           if ((err = edit_sect(&item.sect, key, ptr)) != RET_OK)
-               return err;
+           ret = edit_sect(&item.sect, key, ptr);
+           if (ret != RET_OK)
+               return ret;
            if (!putsect(&item.sect))
                return RET_FAIL;
            break;
        case 's':
            if (!check_ship_ok(&item.ship))
                return RET_FAIL;
-           if ((err = edit_ship(&item.ship, key, ptr)) != RET_OK)
-               return err;
+           ret = edit_ship(&item.ship, key, ptr);
+           if (ret != RET_OK)
+               return ret;
            if (!putship(item.ship.shp_uid, &item.ship))
                return RET_FAIL;
            break;
        case 'u':
            if (!check_land_ok(&item.land))
                return RET_FAIL;
-           if ((err = edit_land(&item.land, key, ptr)) != RET_OK)
-               return err;
+           ret = edit_land(&item.land, key, ptr);
+           if (ret != RET_OK)
+               return ret;
            if (!putland(item.land.lnd_uid, &item.land))
                return RET_FAIL;
            break;
        case 'p':
            if (!check_plane_ok(&item.plane))
                return RET_FAIL;
-           if ((err = edit_plane(&item.plane, key, ptr)) != RET_OK)
-               return err;
+           ret = edit_plane(&item.plane, key, ptr);
+           if (ret != RET_OK)
+               return ret;
            if (!putplane(item.plane.pln_uid, &item.plane))
                return RET_FAIL;
            break;