mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
cleanup: use std::size instead of custom macro
Since there is this standard construct, we might just use it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c1ba82bcc9
commit
ad34652a6f
1 changed files with 7 additions and 9 deletions
|
@ -30,8 +30,6 @@
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "subsurface-time.h"
|
#include "subsurface-time.h"
|
||||||
|
|
||||||
#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
|
|
||||||
|
|
||||||
// TODO: Should probably be moved to struct divelog to allow for multi-document
|
// TODO: Should probably be moved to struct divelog to allow for multi-document
|
||||||
std::string saved_git_id;
|
std::string saved_git_id;
|
||||||
|
|
||||||
|
@ -1074,7 +1072,7 @@ static void divecomputer_parser(char *line, struct git_parser_state *state)
|
||||||
char c = *line;
|
char c = *line;
|
||||||
if (c < 'a' || c > 'z')
|
if (c < 'a' || c > 'z')
|
||||||
sample_parser(line, state);
|
sample_parser(line, state);
|
||||||
match_action(line, state, dc_action, ARRAY_SIZE(dc_action));
|
match_action(line, state, dc_action, std::size(dc_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These need to be sorted! */
|
/* These need to be sorted! */
|
||||||
|
@ -1089,7 +1087,7 @@ struct keyword_action dive_action[] = {
|
||||||
|
|
||||||
static void dive_parser(char *line, struct git_parser_state *state)
|
static void dive_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, dive_action, ARRAY_SIZE(dive_action));
|
match_action(line, state, dive_action, std::size(dive_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These need to be sorted! */
|
/* These need to be sorted! */
|
||||||
|
@ -1101,7 +1099,7 @@ struct keyword_action site_action[] = {
|
||||||
|
|
||||||
static void site_parser(char *line, struct git_parser_state *state)
|
static void site_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, site_action, ARRAY_SIZE(site_action));
|
match_action(line, state, site_action, std::size(site_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These need to be sorted! */
|
/* These need to be sorted! */
|
||||||
|
@ -1113,7 +1111,7 @@ struct keyword_action trip_action[] = {
|
||||||
|
|
||||||
static void trip_parser(char *line, struct git_parser_state *state)
|
static void trip_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, trip_action, ARRAY_SIZE(trip_action));
|
match_action(line, state, trip_action, std::size(trip_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These need to be sorted! */
|
/* These need to be sorted! */
|
||||||
|
@ -1125,7 +1123,7 @@ static struct keyword_action settings_action[] = {
|
||||||
|
|
||||||
static void settings_parser(char *line, struct git_parser_state *state)
|
static void settings_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, settings_action, ARRAY_SIZE(settings_action));
|
match_action(line, state, settings_action, std::size(settings_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These need to be sorted! */
|
/* These need to be sorted! */
|
||||||
|
@ -1137,7 +1135,7 @@ static struct keyword_action picture_action[] = {
|
||||||
|
|
||||||
static void picture_parser(char *line, struct git_parser_state *state)
|
static void picture_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, picture_action, ARRAY_SIZE(picture_action));
|
match_action(line, state, picture_action, std::size(picture_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_filter_preset_constraint_keyvalue(void *_state, const char *key, const std::string &value)
|
static void parse_filter_preset_constraint_keyvalue(void *_state, const char *key, const std::string &value)
|
||||||
|
@ -1234,7 +1232,7 @@ struct keyword_action filter_preset_action[] = {
|
||||||
|
|
||||||
static void filter_preset_parser(char *line, struct git_parser_state *state)
|
static void filter_preset_parser(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
match_action(line, state, filter_preset_action, ARRAY_SIZE(filter_preset_action));
|
match_action(line, state, filter_preset_action, std::size(filter_preset_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue