Core: remove variable name conflict

Having a parameter with the same name as a global variable is potentially
confusing.

Found via LGTM.com

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-03-17 13:52:45 -07:00
parent 6a6c62ecf5
commit 8bbc375fab
3 changed files with 19 additions and 19 deletions

View file

@ -410,8 +410,8 @@ extern void add_dive_to_trip(struct dive *, dive_trip_t *);
struct dive *unregister_dive(int idx); struct dive *unregister_dive(int idx);
extern void delete_single_dive(int idx); extern void delete_single_dive(int idx);
extern void insert_trip(dive_trip_t *trip, struct trip_table *trip_table); extern void insert_trip(dive_trip_t *trip, struct trip_table *trip_table_arg);
extern void unregister_trip(dive_trip_t *trip, struct trip_table *trip_table); extern void unregister_trip(dive_trip_t *trip, struct trip_table *trip_table_arg);
extern void free_trip(dive_trip_t *trip); extern void free_trip(dive_trip_t *trip);
extern timestamp_t trip_date(const struct dive_trip *trip); extern timestamp_t trip_date(const struct dive_trip *trip);

View file

@ -939,17 +939,17 @@ struct dive_trip *unregister_dive_from_trip(struct dive *dive)
return trip; return trip;
} }
static void delete_trip(dive_trip_t *trip, struct trip_table *trip_table) static void delete_trip(dive_trip_t *trip, struct trip_table *trip_table_arg)
{ {
unregister_trip(trip, trip_table); unregister_trip(trip, trip_table_arg);
free_trip(trip); free_trip(trip);
} }
void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table) void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table_arg)
{ {
struct dive_trip *trip = unregister_dive_from_trip(dive); struct dive_trip *trip = unregister_dive_from_trip(dive);
if (trip && trip->dives.nr == 0) if (trip && trip->dives.nr == 0)
delete_trip(trip, trip_table); delete_trip(trip, trip_table_arg);
} }
/* Add dive to a trip. Caller is responsible for removing dive /* Add dive to a trip. Caller is responsible for removing dive
@ -972,10 +972,10 @@ dive_trip_t *alloc_trip(void)
} }
/* insert the trip into the trip table */ /* insert the trip into the trip table */
void insert_trip(dive_trip_t *dive_trip, struct trip_table *trip_table) void insert_trip(dive_trip_t *dive_trip, struct trip_table *trip_table_arg)
{ {
int idx = trip_table_get_insertion_index(trip_table, dive_trip); int idx = trip_table_get_insertion_index(trip_table_arg, dive_trip);
add_to_trip_table(trip_table, idx, dive_trip); add_to_trip_table(trip_table_arg, idx, dive_trip);
#ifdef DEBUG_TRIP #ifdef DEBUG_TRIP
dump_trip_list(); dump_trip_list();
#endif #endif
@ -991,25 +991,25 @@ dive_trip_t *create_trip_from_dive(struct dive *dive)
return trip; return trip;
} }
dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table) dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table_arg)
{ {
dive_trip_t *dive_trip = alloc_trip(); dive_trip_t *dive_trip = alloc_trip();
dive_trip = create_trip_from_dive(dive); dive_trip = create_trip_from_dive(dive);
add_dive_to_trip(dive, dive_trip); add_dive_to_trip(dive, dive_trip);
insert_trip(dive_trip, trip_table); insert_trip(dive_trip, trip_table_arg);
return dive_trip; return dive_trip;
} }
/* remove trip from the trip-list, but don't free its memory. /* remove trip from the trip-list, but don't free its memory.
* caller takes ownership of the trip. */ * caller takes ownership of the trip. */
void unregister_trip(dive_trip_t *trip, struct trip_table *trip_table) void unregister_trip(dive_trip_t *trip, struct trip_table *trip_table_arg)
{ {
int idx = get_idx_in_trip_table(trip_table, trip); int idx = get_idx_in_trip_table(trip_table_arg, trip);
assert(!trip->dives.nr); assert(!trip->dives.nr);
if (idx >= 0) if (idx >= 0)
remove_from_trip_table(trip_table, idx); remove_from_trip_table(trip_table_arg, idx);
} }
/* /*
@ -1111,7 +1111,7 @@ dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *fr
* Walk the dives from the oldest dive in the given table, and see if we * Walk the dives from the oldest dive in the given table, and see if we
* can autogroup them. But only do this when the user selected autogrouping. * can autogroup them. But only do this when the user selected autogrouping.
*/ */
static void autogroup_dives(struct dive_table *table, struct trip_table *trip_table) static void autogroup_dives(struct dive_table *table, struct trip_table *trip_table_arg)
{ {
int from, to; int from, to;
dive_trip_t *trip; dive_trip_t *trip;
@ -1126,9 +1126,9 @@ static void autogroup_dives(struct dive_table *table, struct trip_table *trip_ta
add_dive_to_trip(table->dives[j], trip); add_dive_to_trip(table->dives[j], trip);
/* If this was newly allocated, add trip to list */ /* If this was newly allocated, add trip to list */
if (alloc) if (alloc)
insert_trip(trip, trip_table); insert_trip(trip, trip_table_arg);
} }
sort_trip_table(trip_table); sort_trip_table(trip_table_arg);
#ifdef DEBUG_TRIP #ifdef DEBUG_TRIP
dump_trip_list(); dump_trip_list();
#endif #endif

View file

@ -35,10 +35,10 @@ extern void add_single_dive(int idx, struct dive *dive);
extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p); extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
extern int get_divenr(const struct dive *dive); extern int get_divenr(const struct dive *dive);
extern struct dive_trip *unregister_dive_from_trip(struct dive *dive); extern struct dive_trip *unregister_dive_from_trip(struct dive *dive);
extern void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table); extern void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table_arg);
extern dive_trip_t *alloc_trip(void); extern dive_trip_t *alloc_trip(void);
extern dive_trip_t *create_trip_from_dive(struct dive *dive); extern dive_trip_t *create_trip_from_dive(struct dive *dive);
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table); extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table_arg);
extern dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated); extern dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated);
extern dive_trip_t *get_trip_for_new_dive(struct dive *new_dive, bool *allocated); extern dive_trip_t *get_trip_for_new_dive(struct dive *new_dive, bool *allocated);
extern bool consecutive_selected(); extern bool consecutive_selected();