]> git.tue.mpg.de Git - paraslash.git/commitdiff
mmd: rename dbt_num to selector_num
authorAndre <maan@p133.(none)>
Fri, 10 Mar 2006 21:32:33 +0000 (22:32 +0100)
committerAndre <maan@p133.(none)>
Fri, 10 Mar 2006 21:32:33 +0000 (22:32 +0100)
afs.c
command.c
server.c
server.h

diff --git a/afs.c b/afs.c
index a51db969f4853ea951549e9e5721e40aa397d5d0..0712cc2720683b3fa8f08194eba95fd5691ab996 100644 (file)
--- 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);
index ee165e88b923efda643fc54845790394741557ed..e94fb8efa88748566e7904f81dd0a9c001a1cdf1 100644 (file)
--- 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);
index d881868c09cc826e561c2d7d49b5bb03de8fd4ea..59bc7935645a59907a17f1172500a7f19e38818e 100644 (file)
--- 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);
index da777f771d90386e2626183b6ba120e4bde49514..0ab0197df1bd66ed9db6b7c56b6eca5e64c46cee 100644 (file)
--- 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 */