X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=divelist.c;h=81779f06d25af2a4e10a05dfa62e953cdec0be7c;hb=4891fa812f04da1f46075433d28fa0f33145e125;hp=eb8f231432a99f33f40a8ca0341aee8a66b14148;hpb=d03a92728fb625a388ce4eb4d8e885c6fc40d55a;p=ext%2Fsubsurface.git diff --git a/divelist.c b/divelist.c index eb8f231..81779f0 100644 --- a/divelist.c +++ b/divelist.c @@ -335,6 +335,14 @@ static int calculate_sac(struct dive *dive) return sac * 1000; } +void update_cylinder_related_info(struct dive *dive) +{ + if (dive != NULL) { + dive->sac = calculate_sac(dive); + dive->otu = calculate_otu(dive); + } +} + static void get_string(char **str, const char *s) { int len; @@ -452,8 +460,7 @@ static void fill_dive_list(void) for (i = 0; i < dive_table.nr; i++) { struct dive *dive = dive_table.dives[i]; - dive->otu = calculate_otu(dive); - dive->sac = calculate_sac(dive); + update_cylinder_related_info(dive); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, DIVE_INDEX, i,