aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-09 19:20:05 +0200
committerMax Kellermann <max@duempel.org>2008-10-09 19:20:05 +0200
commit4beba26c615ae88df81a9cb848c971594848fee4 (patch)
tree1d5cad4262c3917066ae45243727736a5ceb731e
parentf1022bcc12dbdf5b7974fb1510197b12214fec32 (diff)
downloadmpd-4beba26c615ae88df81a9cb848c971594848fee4.tar.gz
mpd-4beba26c615ae88df81a9cb848c971594848fee4.tar.xz
mpd-4beba26c615ae88df81a9cb848c971594848fee4.zip
update: make the job id unsigned
Since the return value cannot be -1 anymore, we can make it unsigned.
-rw-r--r--src/command.c2
-rw-r--r--src/database.c2
-rw-r--r--src/update.c12
-rw-r--r--src/update.h6
4 files changed, 13 insertions, 9 deletions
diff --git a/src/command.c b/src/command.c
index 1d2645cd1..2cada67d9 100644
--- a/src/command.c
+++ b/src/command.c
@@ -807,7 +807,7 @@ static int handleUpdate(struct client *client,
mpd_unused int argc, char *argv[])
{
char *path = NULL;
- int ret;
+ unsigned ret;
assert(argc <= 2);
if (argc == 2 && !(path = sanitizePathDup(argv[1]))) {
diff --git a/src/database.c b/src/database.c
index 2581e408b..93ce2e96b 100644
--- a/src/database.c
+++ b/src/database.c
@@ -41,7 +41,7 @@ static time_t directory_dbModTime;
void
db_init(void)
{
- int ret;
+ unsigned ret;
music_root = directory_new("", NULL);
diff --git a/src/update.c b/src/update.c
index a962cca98..78bbf64b0 100644
--- a/src/update.c
+++ b/src/update.c
@@ -48,15 +48,16 @@ static size_t update_paths_nr;
static pthread_t update_thr;
-static const int update_task_id_max = 1 << 15;
+static const unsigned update_task_id_max = 1 << 15;
-static int update_task_id;
+static unsigned update_task_id;
static struct song *delete;
static struct condition delete_cond;
-int isUpdatingDB(void)
+unsigned
+isUpdatingDB(void)
{
return (progress != UPDATE_PROGRESS_IDLE) ? update_task_id : 0;
}
@@ -428,12 +429,13 @@ static void spawn_update_task(char *path)
DEBUG("spawned thread for update job id %i\n", update_task_id);
}
-int directory_update_init(char *path)
+unsigned
+directory_update_init(char *path)
{
assert(pthread_equal(pthread_self(), main_task));
if (progress != UPDATE_PROGRESS_IDLE) {
- int next_task_id;
+ unsigned next_task_id;
if (!path)
return 0;
diff --git a/src/update.h b/src/update.h
index 5c7277e32..0b54ed8f2 100644
--- a/src/update.h
+++ b/src/update.h
@@ -20,14 +20,16 @@
#ifndef UPDATE_H
#define UPDATE_H
-int isUpdatingDB(void);
+unsigned
+isUpdatingDB(void);
/*
* returns the positive update job ID on success,
* returns 0 if busy
* @path will be freed by this function and should not be reused
*/
-int directory_update_init(char *path);
+unsigned
+directory_update_init(char *path);
void reap_update_task(void);