- if (nr_dives >= nr_allocated) {
- nr_allocated = (nr_dives + 32) * 3 / 2;
- dive_table = realloc(dive_table, nr_allocated * sizeof(struct dive *));
- if (!dive_table)
- exit(1);
- }
- dive_table[nr_dives++] = dive;
-}
-
-static void show_dive(int nr, struct dive *dive)
-{
- int i;
- struct tm *tm;
-
- tm = gmtime(&dive->when);
-
- printf("At %02d:%02d:%02d %04d-%02d-%02d (%d ft max, %d minutes)\n",
- tm->tm_hour, tm->tm_min, tm->tm_sec,
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- to_feet(dive->maxdepth), dive->duration.seconds / 60);
+ int nr = dive_table.nr, allocated = dive_table.allocated;
+ struct dive **dives = dive_table.dives;