edit: Clean up a few assignments within conditionals

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-03-29 17:35:50 +01:00
parent 859627c416
commit 2b4eaca8b1

View 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;