diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-26 10:04:14 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-26 21:44:04 -0700 |
commit | 3f197336aa3aa1485bd1fdc38d21050006857909 (patch) | |
tree | 7ed1f5dd2b3a341a5ae03f02339e9621ec054e0c /dive.h | |
parent | e544ca5f6a0c888a76dfb27c824712549fafe488 (diff) | |
download | subsurface-3f197336aa3aa1485bd1fdc38d21050006857909.tar.gz |
Remove 'tripflag' from dive trips
Both dives and dive trips have the same 'tripflag' thing, but they are
used very differently. In particular, for dive trips, the only case
that has any meaning is the TF_AUTOGEN case, so instead of having that
trip flag, replace it with a bitfield that says whether the trip was
auto-generated or not.
And make the one-bit bitfields explicitly unsigned. Signed bitfields
are almost always a mistake, and can be confusing.
Also remove a few now stale macros that are no longer needed now that we
don't do the GList thing for dive list handling, and our autogen logic
has been simplified.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -269,17 +269,16 @@ struct divecomputer { #define W_IDX_PRIMARY 0 #define W_IDX_SECONDARY 1 -typedef enum { TF_NONE, NO_TRIP, IN_TRIP, AUTOGEN_TRIP, ASSIGNED_TRIP, NUM_TRIPFLAGS } tripflag_t; +typedef enum { TF_NONE, NO_TRIP, IN_TRIP, ASSIGNED_TRIP, NUM_TRIPFLAGS } tripflag_t; extern const char *tripflag_names[NUM_TRIPFLAGS]; typedef struct dive_trip { - tripflag_t tripflag; timestamp_t when; char *location; char *notes; struct dive *dives; int nrdives; - int expanded:1, selected:1; + unsigned expanded:1, selected:1, autogen:1; struct dive_trip *next; } dive_trip_t; @@ -359,8 +358,6 @@ extern gboolean autogroup; #define UNGROUPED_DIVE(_dive) ((_dive)->tripflag == NO_TRIP) #define DIVE_IN_TRIP(_dive) ((_dive)->tripflag == IN_TRIP || (_dive)->tripflag == ASSIGNED_TRIP) #define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE) -#define DIVE_TRIP(_trip) ((dive_trip_t *)(_trip)->data) -#define DIVE_FITS_TRIP(_dive, _dive_trip) ((_dive_trip)->when - TRIP_THRESHOLD <= (_dive)->when) extern void add_dive_to_trip(struct dive *, dive_trip_t *); extern void remove_dive_from_trip(struct dive *); |