From 093551363602e723864467af0812f13f4525855f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 19 Apr 2020 16:18:09 +0200 Subject: core: remove new_picture_for_dive() function in dive.c We can do the same with get_picture_idx(). Yes, it is a bit more unwieldy. However a full reimplementation seems not worth it. We could make this a one-liner helper function though. Signed-off-by: Berthold Stoeger --- core/dive.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'core/dive.c') diff --git a/core/dive.c b/core/dive.c index abfff2bc5..8ed9995b8 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3498,15 +3498,6 @@ void set_git_prefs(const char *prefs) git_prefs.pp_graphs.po2 = 1; } -static bool new_picture_for_dive(struct dive *d, const char *filename) -{ - FOR_EACH_PICTURE (d) { - if (same_string(picture->filename, filename)) - return false; - } - return true; -} - /* Return distance of timestamp to time of dive. Result is always positive, 0 means during dive. */ static timestamp_t time_from_dive(const struct dive *d, timestamp_t timestamp) { @@ -3591,7 +3582,7 @@ void create_picture(const char *filename, int shift_time, bool match_all) if (!dive) return; - if (!new_picture_for_dive(dive, filename)) + if (get_picture_idx(&dive->pictures, filename) >= 0) return; if (!match_all && !dive_check_picture_time(dive, timestamp)) return; -- cgit v1.2.3-70-g09d2