From ec1d91a34ff4d822a673ee946f8fcf0a49221623 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 21 Mar 2011 20:43:21 +0100 Subject: [PATCH] Simplify eta_calc(): drop pointer parameter, return value instead --- src/lib/commands/orde.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/commands/orde.c b/src/lib/commands/orde.c index b6f019f0..1d1b3313 100644 --- a/src/lib/commands/orde.c +++ b/src/lib/commands/orde.c @@ -284,14 +284,14 @@ orde(void) return RET_OK; } -static void -eta_calc(struct shpstr *sp, int len, int *nupdates) +static int +eta_calc(struct shpstr *sp, int len) { double mobcost, mobil; - int i; + int i, nupdates; i = len; - *nupdates = 1; + nupdates = 1; mobcost = shp_mobcost(sp); mobil = sp->shp_mobil; @@ -301,9 +301,10 @@ eta_calc(struct shpstr *sp, int len, int *nupdates) i--; } else { mobil += (ship_mob_scale * (float)etu_per_update); - (*nupdates)++; + nupdates++; } } + return nupdates; } static void @@ -440,7 +441,7 @@ sorde(void) else { /* distance to destination */ len = strlen(c); - eta_calc(&ship, len, &updates); + updates = eta_calc(&ship, len); pr(" %3d %4d", len, updates); } }