From b93523c0b1009f7ff3e6f1629ad11ab7594333fb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Oct 2013 21:45:32 +0200 Subject: [PATCH] UpdateGlue: never pass null to update_enqueue() --- src/Main.cxx | 2 +- src/OtherCommands.cxx | 6 +++--- src/UpdateGlue.hxx | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index 726bfc5d4..3c88fc3c4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -468,7 +468,7 @@ int mpd_main(int argc, char *argv[]) if (create_db) { /* the database failed to load: recreate the database */ - unsigned job = update_enqueue(nullptr, true); + unsigned job = update_enqueue("", true); if (job == 0) FatalError("directory update failed"); } diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index f60078cf9..507e4df17 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -157,7 +157,7 @@ handle_lsinfo(Client *client, int argc, char *argv[]) enum command_return handle_update(Client *client, gcc_unused int argc, char *argv[]) { - const char *path = NULL; + const char *path = ""; unsigned ret; assert(argc <= 2); @@ -166,7 +166,7 @@ handle_update(Client *client, gcc_unused int argc, char *argv[]) if (*path == 0 || strcmp(path, "/") == 0) /* backwards compatibility with MPD 0.15 */ - path = NULL; + path = ""; else if (!uri_safe_local(path)) { command_error(client, ACK_ERROR_ARG, "Malformed path"); @@ -188,7 +188,7 @@ handle_update(Client *client, gcc_unused int argc, char *argv[]) enum command_return handle_rescan(Client *client, gcc_unused int argc, char *argv[]) { - const char *path = NULL; + const char *path = ""; unsigned ret; assert(argc <= 2); diff --git a/src/UpdateGlue.hxx b/src/UpdateGlue.hxx index 9d546a2a3..c9fc0f9a1 100644 --- a/src/UpdateGlue.hxx +++ b/src/UpdateGlue.hxx @@ -20,6 +20,8 @@ #ifndef MPD_UPDATE_GLUE_HXX #define MPD_UPDATE_GLUE_HXX +#include "Compiler.h" + void update_global_init(void); void update_global_finish(void); @@ -30,10 +32,11 @@ isUpdatingDB(void); /** * Add this path to the database update queue. * - * @param path a path to update; if NULL or an empty string, + * @param path a path to update; if an empty string, * the whole music directory is updated * @return the job id, or 0 on error */ +gcc_nonnull_all unsigned update_enqueue(const char *path, bool discard);