Clean up macros and auxiliary functions

In preparation for the next stage of the trips handling this commit makes
the macros used to access trips (and some frequently used variables for
the tree and list models) more consistent.

This also changes the way we display un-grouped dives in the dive list,
i.e. dives that are not part of a dive trip. Their dive number is now
printed bold.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-08-29 17:24:15 -07:00
parent ca16f438ac
commit a5f894d1d3
4 changed files with 75 additions and 40 deletions

View file

@ -291,6 +291,8 @@ static void save_trip(FILE *f, struct dive *trip)
fprintf(f, "<trip");
fprintf(f, " date='%04u-%02u-%02u'",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
fprintf(f, " time='%02u:%02u:%02u'",
tm->tm_hour, tm->tm_min, tm->tm_sec);
if (trip->location)
show_utf8(f, trip->location, " location=\'","\'", 1);
fprintf(f, " />\n");
@ -341,7 +343,7 @@ void save_dives(const char *filename)
fprintf(f, "<dives>\n<program name='subsurface' version='%d'></program>\n", VERSION);
/* save the trips */
while ((trip = NEXT_TRIP(trip, dive_trip_list)) != 0)
while ((trip = NEXT_TRIP(trip)) != NULL)
save_trip(f, trip->data);
/* save the dives */