From b211d31a6447f87c17711dda092917a6d0de0b45 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 17 Jul 2018 20:39:33 +0200 Subject: [PATCH] config/Data: add getter methods --- src/config/Data.cxx | 2 +- src/config/Data.hxx | 12 +++++++++++- src/config/Global.cxx | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/config/Data.cxx b/src/config/Data.cxx index 1dde20b4d..2eee5e23e 100644 --- a/src/config/Data.cxx +++ b/src/config/Data.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2017 The Music Player Daemon Project + * Copyright 2003-2018 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify diff --git a/src/config/Data.hxx b/src/config/Data.hxx index 9d63d147b..6c5200347 100644 --- a/src/config/Data.hxx +++ b/src/config/Data.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2017 The Music Player Daemon Project + * Copyright 2003-2018 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,16 @@ struct ConfigData { std::array blocks; void Clear(); + + gcc_pure + const ConfigParam *GetParam(ConfigOption option) noexcept { + return params[size_t(option)]; + } + + gcc_pure + const ConfigBlock *GetBlock(ConfigBlockOption option) noexcept { + return blocks[size_t(option)]; + } }; #endif diff --git a/src/config/Global.cxx b/src/config/Global.cxx index 2b224c318..547e5fa27 100644 --- a/src/config/Global.cxx +++ b/src/config/Global.cxx @@ -77,13 +77,13 @@ void config_global_check(void) const ConfigParam * config_get_param(ConfigOption option) noexcept { - return config_data.params[unsigned(option)]; + return config_data.GetParam(option); } const ConfigBlock * config_get_block(ConfigBlockOption option) noexcept { - return config_data.blocks[unsigned(option)]; + return config_data.GetBlock(option); } const ConfigBlock *