From 5348808bf594de927cc64eebae9118d6971343b1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Sep 2013 09:40:32 +0200 Subject: PlaylistPlugin, ConfigGlobal: use nullptr instead of NULL --- src/ConfigGlobal.cxx | 10 +++++----- src/ConfigGlobal.hxx | 6 ++---- src/PlaylistPlugin.hxx | 10 ++++------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/ConfigGlobal.cxx b/src/ConfigGlobal.cxx index 0bf2b4433..07c5ddd96 100644 --- a/src/ConfigGlobal.cxx +++ b/src/ConfigGlobal.cxx @@ -92,7 +92,7 @@ config_get_string(ConfigOption option, const char *default_value) { const struct config_param *param = config_get_param(option); - if (param == NULL) + if (param == nullptr) return default_value; return param->value; @@ -102,7 +102,7 @@ Path config_get_path(ConfigOption option, Error &error) { const struct config_param *param = config_get_param(option); - if (param == NULL) + if (param == nullptr) return Path::Null(); Path path = ParsePath(param->value, error); @@ -120,7 +120,7 @@ config_get_unsigned(ConfigOption option, unsigned default_value) long value; char *endptr; - if (param == NULL) + if (param == nullptr) return default_value; value = strtol(param->value, &endptr, 0); @@ -138,7 +138,7 @@ config_get_positive(ConfigOption option, unsigned default_value) long value; char *endptr; - if (param == NULL) + if (param == nullptr) return default_value; value = strtol(param->value, &endptr, 0); @@ -157,7 +157,7 @@ config_get_bool(ConfigOption option, bool default_value) const struct config_param *param = config_get_param(option); bool success, value; - if (param == NULL) + if (param == nullptr) return default_value; success = get_bool(param->value, &value); diff --git a/src/ConfigGlobal.hxx b/src/ConfigGlobal.hxx index b4aa5fd85..c49679942 100644 --- a/src/ConfigGlobal.hxx +++ b/src/ConfigGlobal.hxx @@ -23,8 +23,6 @@ #include "ConfigOption.hxx" #include "gcc.h" -#include - class Error; class Path; @@ -41,7 +39,7 @@ bool ReadConfigFile(const Path &path, Error &error); /* don't free the returned value - set _last_ to NULL to get first entry */ + set _last_ to nullptr to get first entry */ gcc_pure const struct config_param * config_get_next_param(enum ConfigOption option, @@ -51,7 +49,7 @@ gcc_pure static inline const struct config_param * config_get_param(enum ConfigOption option) { - return config_get_next_param(option, NULL); + return config_get_next_param(option, nullptr); } /* Note on gcc_pure: Some of the functions declared pure are not diff --git a/src/PlaylistPlugin.hxx b/src/PlaylistPlugin.hxx index 069b818ba..f89fd9ce0 100644 --- a/src/PlaylistPlugin.hxx +++ b/src/PlaylistPlugin.hxx @@ -23,8 +23,6 @@ #include "thread/Mutex.hxx" #include "thread/Cond.hxx" -#include - struct config_param; struct input_stream; struct Tag; @@ -50,7 +48,7 @@ struct playlist_plugin { /** * Initialize the plugin. Optional method. * - * @param param a configuration block for this plugin, or NULL + * @param param a configuration block for this plugin, or nullptr * if none is configured * @return true if the plugin was initialized successfully, * false if the plugin is not available @@ -89,7 +87,7 @@ struct playlist_plugin { /** * Initialize a plugin. * - * @param param a configuration block for this plugin, or NULL if none + * @param param a configuration block for this plugin, or nullptr if none * is configured * @return true if the plugin was initialized successfully, false if * the plugin is not available @@ -98,7 +96,7 @@ static inline bool playlist_plugin_init(const struct playlist_plugin *plugin, const config_param ¶m) { - return plugin->init != NULL + return plugin->init != nullptr ? plugin->init(param) : true; } @@ -109,7 +107,7 @@ playlist_plugin_init(const struct playlist_plugin *plugin, static inline void playlist_plugin_finish(const struct playlist_plugin *plugin) { - if (plugin->finish != NULL) + if (plugin->finish != nullptr) plugin->finish(); } -- cgit v1.2.3