mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add a FOR_EACH_PICTURE macro and the code for picture_count.
Add the FOR_EACH_PICTURE macro and the code for picture count. This uses C99 - but I will keep it like this and wait for dirk to scream at me. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
cfa51c6526
commit
dfac5e93c4
2 changed files with 7 additions and 0 deletions
4
dive.c
4
dive.c
|
@ -2272,6 +2272,10 @@ struct picture* dive_add_picture(struct dive *d, char *picture)
|
|||
|
||||
uint dive_get_picture_count(struct dive *d)
|
||||
{
|
||||
uint i = 0;
|
||||
FOR_EACH_PICTURE( d )
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
void dive_remove_picture(struct dive *d, char *picture)
|
||||
|
|
3
dive.h
3
dive.h
|
@ -289,6 +289,9 @@ struct picture {
|
|||
struct picture *next;
|
||||
};
|
||||
|
||||
#define FOR_EACH_PICTURE( DIVE ) \
|
||||
for(struct picture *picture = DIVE->picture_list; picture; picture = picture->next)
|
||||
|
||||
extern struct picture *dive_add_picture(struct dive *d, char *picture);
|
||||
extern void dive_remove_picture(struct dive *d, char *picture);
|
||||
extern uint dive_get_picture_count(struct dive *d);
|
||||
|
|
Loading…
Reference in a new issue