From c29a66c884d0e7f7329a3be2931490e47f0cd9ff Mon Sep 17 00:00:00 2001 From: Andre Date: Fri, 10 Mar 2006 22:32:33 +0100 Subject: [PATCH] mmd: rename dbt_num to selector_num --- afs.c | 6 +++--- command.c | 13 +++++++------ server.c | 24 ++++++++++++------------ server.h | 2 +- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/afs.c b/afs.c index a51db969..0712cc27 100644 --- a/afs.c +++ b/afs.c @@ -233,7 +233,7 @@ static int update_mmd(void) static void get_song(void) { - char **sl = dblist[mmd->dbt_num].get_audio_file_list(10); + char **sl = dblist[mmd->selector_num].get_audio_file_list(10); int i; if (!sl) @@ -253,8 +253,8 @@ static void get_song(void) continue; } mmd->num_played++; - if (dblist[mmd->dbt_num].update_audio_file) - dblist[mmd->dbt_num].update_audio_file(sl[i]); + if (dblist[mmd->selector_num].update_audio_file) + dblist[mmd->selector_num].update_audio_file(sl[i]); PARA_DEBUG_LOG("%s", "success\n"); mmd->new_afs_status_flags &= (~AFS_NEXT); gettimeofday(&now, NULL); diff --git a/command.c b/command.c index ee165e88..e94fb8ef 100644 --- a/command.c +++ b/command.c @@ -426,7 +426,7 @@ static char *get_status(struct misc_meta_data *nmmd) status_item_list[SI_STATUS_BAR], bar ? bar : "(none)", status_item_list[SI_STATUS], status, status_item_list[SI_STATUS_FLAGS], flags, - status_item_list[SI_SELECTOR], dblist[nmmd->dbt_num].name, + status_item_list[SI_SELECTOR], dblist[nmmd->selector_num].name, status_item_list[SI_OFFSET], offset, status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format), @@ -734,8 +734,9 @@ static struct server_command *get_cmd_ptr(char *name, char **handler) /* not found, look for commands supported by the current selector */ mmd_lock(); if (handler) - *handler = make_message("the %s selector", dblist[mmd->dbt_num].name); - cmd = dblist[mmd->dbt_num].cmd_list; + *handler = make_message("the %s selector", + dblist[mmd->selector_num].name); + cmd = dblist[mmd->selector_num].cmd_list; mmd_unlock(); for (; cmd->name; cmd++) if (!strcmp(cmd->name, name)) @@ -755,8 +756,8 @@ static int com_help(int fd, int argc, char **argv) if ((ret = send_description(fd, cmd_struct, "server", 0)) < 0) return ret; mmd_lock(); - handler = para_strdup(dblist[mmd->dbt_num].name); - cmd = dblist[mmd->dbt_num].cmd_list; + handler = para_strdup(dblist[mmd->selector_num].name); + cmd = dblist[mmd->selector_num].cmd_list; mmd_unlock(); ret = send_description(fd, cmd, handler, 0); free(handler); @@ -854,7 +855,7 @@ static int com_chs(int fd, int argc, char **argv) if (!argc) { char *selector; mmd_lock(); - selector = para_strdup(dblist[mmd->dbt_num].name); + selector = para_strdup(dblist[mmd->selector_num].name); mmd_unlock(); ret = send_va_buffer(fd, "%s\n", selector); free(selector); diff --git a/server.c b/server.c index d881868c..59bc7935 100644 --- a/server.c +++ b/server.c @@ -174,7 +174,7 @@ static void shm_init(void) goto err_out; mmd_mutex = ret; - mmd->dbt_num = 0; + mmd->selector_num = 0; mmd->num_played = 0; mmd->num_commands = 0; mmd->events = 0; @@ -294,12 +294,12 @@ static void init_selector(void) PARA_WARNING_LOG("%s", PARA_STRERROR(-ret)); break; } - mmd->dbt_num = i; + mmd->selector_num = i; return; } PARA_WARNING_LOG("%s", "falling back to the random selector\n"); random: - mmd->dbt_num = 0; + mmd->selector_num = 0; dblist[0].init(&dblist[0]); /* always successful */ } @@ -372,19 +372,19 @@ static unsigned do_inits(int argc, char **argv) static void handle_dbt_change(void) { - int ret, old = mmd->dbt_num, new = mmd->dbt_change; + int ret, old = mmd->selector_num, new = mmd->dbt_change; dblist[old].shutdown(); ret = dblist[new].init(&dblist[new]); mmd->dbt_change = -1; /* reset */ if (ret >= 0) { - mmd->dbt_num = new; + mmd->selector_num = new; return; } /* init failed */ PARA_ERROR_LOG("%s -- switching to the random selector\n", PARA_STRERROR(-ret)); dblist[0].init(&dblist[0]); - mmd->dbt_num = 0; + mmd->selector_num = 0; } /* @@ -396,7 +396,7 @@ static void handle_sighup(void) close_log(logfile); /* gets reopened if necessary by parse_config */ logfile = NULL; parse_config(1); /* reopens log */ - mmd->dbt_change = mmd->dbt_num; /* do not change selector */ + mmd->dbt_change = mmd->selector_num; /* do not change selector */ handle_dbt_change(); /* reload selector */ } @@ -459,8 +459,8 @@ repeat: &max_fileno, &rfds, &wfds); } - if (dblist[mmd->dbt_num].pre_select) { - ret = dblist[mmd->dbt_num].pre_select(&rfds, &wfds); + if (dblist[mmd->selector_num].pre_select) { + ret = dblist[mmd->selector_num].pre_select(&rfds, &wfds); max_fileno = MAX(max_fileno, ret); } mmd_unlock(); @@ -471,8 +471,8 @@ repeat: mmd_lock(); if (mmd->dbt_change >= 0) handle_dbt_change(); - if (dblist[mmd->dbt_num].post_select) - dblist[mmd->dbt_num].post_select(&rfds, &wfds); + if (dblist[mmd->selector_num].post_select) + dblist[mmd->selector_num].post_select(&rfds, &wfds); if (ret < 0 && err == EINTR) goto repeat; if (ret < 0) { @@ -507,7 +507,7 @@ repeat: case SIGTERM: PARA_EMERG_LOG("terminating on signal %d\n", sig); kill(0, SIGTERM); - dblist[mmd->dbt_num].shutdown(); + dblist[mmd->selector_num].shutdown(); mutex_destroy(mmd_mutex); shm_detach(mmd); shm_destroy(mmd_shm_id); diff --git a/server.h b/server.h index da777f77..0ab0197d 100644 --- a/server.h +++ b/server.h @@ -142,7 +142,7 @@ struct misc_meta_data{ /** a string that gets filled in by the current audio file selector */ char selector_info[MMD_INFO_SIZE]; /** the number if the current database tool */ - int dbt_num; + int selector_num; /** commands set this to non-zero to request a database tool change */ int dbt_change; /** used by the sender command */ -- 2.39.5