media: use table instead of linked list for media

For consistency with equipment, use our table macros for pictures.
Generally tables (arrays) are preferred over linked lists, because
they allow random access.

This is mostly copy & paste of the equipment code.

Sadly, our table macros are quite messy and need some revamping.
Therefore, the resulting code is likewise somewhat messy.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-11 17:41:56 +02:00 committed by Dirk Hohndel
parent 282041e228
commit 989d6a3f96
15 changed files with 136 additions and 106 deletions

View file

@ -116,8 +116,10 @@ static bool removePictureFromSelectedDive(const char *fileUrl)
int i;
struct dive *dive;
for_each_dive (i, dive) {
if (dive->selected && dive_remove_picture(dive, fileUrl))
if (dive->selected && remove_picture(&dive->pictures, fileUrl)) {
invalidate_dive_cache(dive);
return true;
}
}
return false;
}