UpdateGlue: never pass null to update_enqueue()

This commit is contained in:
Max Kellermann 2013-10-17 21:45:32 +02:00
parent 7ef40de98b
commit b93523c0b1
3 changed files with 8 additions and 5 deletions

View File

@ -468,7 +468,7 @@ int mpd_main(int argc, char *argv[])
if (create_db) { if (create_db) {
/* the database failed to load: recreate the /* the database failed to load: recreate the
database */ database */
unsigned job = update_enqueue(nullptr, true); unsigned job = update_enqueue("", true);
if (job == 0) if (job == 0)
FatalError("directory update failed"); FatalError("directory update failed");
} }

View File

@ -157,7 +157,7 @@ handle_lsinfo(Client *client, int argc, char *argv[])
enum command_return enum command_return
handle_update(Client *client, gcc_unused int argc, char *argv[]) handle_update(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *path = NULL; const char *path = "";
unsigned ret; unsigned ret;
assert(argc <= 2); assert(argc <= 2);
@ -166,7 +166,7 @@ handle_update(Client *client, gcc_unused int argc, char *argv[])
if (*path == 0 || strcmp(path, "/") == 0) if (*path == 0 || strcmp(path, "/") == 0)
/* backwards compatibility with MPD 0.15 */ /* backwards compatibility with MPD 0.15 */
path = NULL; path = "";
else if (!uri_safe_local(path)) { else if (!uri_safe_local(path)) {
command_error(client, ACK_ERROR_ARG, command_error(client, ACK_ERROR_ARG,
"Malformed path"); "Malformed path");
@ -188,7 +188,7 @@ handle_update(Client *client, gcc_unused int argc, char *argv[])
enum command_return enum command_return
handle_rescan(Client *client, gcc_unused int argc, char *argv[]) handle_rescan(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *path = NULL; const char *path = "";
unsigned ret; unsigned ret;
assert(argc <= 2); assert(argc <= 2);

View File

@ -20,6 +20,8 @@
#ifndef MPD_UPDATE_GLUE_HXX #ifndef MPD_UPDATE_GLUE_HXX
#define MPD_UPDATE_GLUE_HXX #define MPD_UPDATE_GLUE_HXX
#include "Compiler.h"
void update_global_init(void); void update_global_init(void);
void update_global_finish(void); void update_global_finish(void);
@ -30,10 +32,11 @@ isUpdatingDB(void);
/** /**
* Add this path to the database update queue. * 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 * the whole music directory is updated
* @return the job id, or 0 on error * @return the job id, or 0 on error
*/ */
gcc_nonnull_all
unsigned unsigned
update_enqueue(const char *path, bool discard); update_enqueue(const char *path, bool discard);