PlaylistPlugin, ConfigGlobal: use nullptr instead of NULL

This commit is contained in:
Max Kellermann 2013-09-05 09:40:32 +02:00
parent fccba1af2a
commit 5348808bf5
3 changed files with 11 additions and 15 deletions

View File

@ -92,7 +92,7 @@ config_get_string(ConfigOption option, const char *default_value)
{ {
const struct config_param *param = config_get_param(option); const struct config_param *param = config_get_param(option);
if (param == NULL) if (param == nullptr)
return default_value; return default_value;
return param->value; return param->value;
@ -102,7 +102,7 @@ Path
config_get_path(ConfigOption option, Error &error) config_get_path(ConfigOption option, Error &error)
{ {
const struct config_param *param = config_get_param(option); const struct config_param *param = config_get_param(option);
if (param == NULL) if (param == nullptr)
return Path::Null(); return Path::Null();
Path path = ParsePath(param->value, error); Path path = ParsePath(param->value, error);
@ -120,7 +120,7 @@ config_get_unsigned(ConfigOption option, unsigned default_value)
long value; long value;
char *endptr; char *endptr;
if (param == NULL) if (param == nullptr)
return default_value; return default_value;
value = strtol(param->value, &endptr, 0); value = strtol(param->value, &endptr, 0);
@ -138,7 +138,7 @@ config_get_positive(ConfigOption option, unsigned default_value)
long value; long value;
char *endptr; char *endptr;
if (param == NULL) if (param == nullptr)
return default_value; return default_value;
value = strtol(param->value, &endptr, 0); 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); const struct config_param *param = config_get_param(option);
bool success, value; bool success, value;
if (param == NULL) if (param == nullptr)
return default_value; return default_value;
success = get_bool(param->value, &value); success = get_bool(param->value, &value);

View File

@ -23,8 +23,6 @@
#include "ConfigOption.hxx" #include "ConfigOption.hxx"
#include "gcc.h" #include "gcc.h"
#include <stddef.h>
class Error; class Error;
class Path; class Path;
@ -41,7 +39,7 @@ bool
ReadConfigFile(const Path &path, Error &error); ReadConfigFile(const Path &path, Error &error);
/* don't free the returned value /* don't free the returned value
set _last_ to NULL to get first entry */ set _last_ to nullptr to get first entry */
gcc_pure gcc_pure
const struct config_param * const struct config_param *
config_get_next_param(enum ConfigOption option, config_get_next_param(enum ConfigOption option,
@ -51,7 +49,7 @@ gcc_pure
static inline const struct config_param * static inline const struct config_param *
config_get_param(enum ConfigOption option) 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 /* Note on gcc_pure: Some of the functions declared pure are not

View File

@ -23,8 +23,6 @@
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "thread/Cond.hxx" #include "thread/Cond.hxx"
#include <stddef.h>
struct config_param; struct config_param;
struct input_stream; struct input_stream;
struct Tag; struct Tag;
@ -50,7 +48,7 @@ struct playlist_plugin {
/** /**
* Initialize the plugin. Optional method. * 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 * if none is configured
* @return true if the plugin was initialized successfully, * @return true if the plugin was initialized successfully,
* false if the plugin is not available * false if the plugin is not available
@ -89,7 +87,7 @@ struct playlist_plugin {
/** /**
* Initialize a 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 * is configured
* @return true if the plugin was initialized successfully, false if * @return true if the plugin was initialized successfully, false if
* the plugin is not available * the plugin is not available
@ -98,7 +96,7 @@ static inline bool
playlist_plugin_init(const struct playlist_plugin *plugin, playlist_plugin_init(const struct playlist_plugin *plugin,
const config_param &param) const config_param &param)
{ {
return plugin->init != NULL return plugin->init != nullptr
? plugin->init(param) ? plugin->init(param)
: true; : true;
} }
@ -109,7 +107,7 @@ playlist_plugin_init(const struct playlist_plugin *plugin,
static inline void static inline void
playlist_plugin_finish(const struct playlist_plugin *plugin) playlist_plugin_finish(const struct playlist_plugin *plugin)
{ {
if (plugin->finish != NULL) if (plugin->finish != nullptr)
plugin->finish(); plugin->finish();
} }