]> git.tue.mpg.de Git - paraslash.git/commitdiff
rename the array of supported audio file senders from 'dblist' to 'selectors'
authorAndre <maan@p133.(none)>
Tue, 4 Apr 2006 10:53:47 +0000 (12:53 +0200)
committerAndre <maan@p133.(none)>
Tue, 4 Apr 2006 10:53:47 +0000 (12:53 +0200)
afs.c
command.c
server.c

diff --git a/afs.c b/afs.c
index 6dac43d79a61a8d3b7d041c406af2eed61b14028..4a4e46e71c1556eef9716a0463cb9e808518a4ab 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -38,7 +38,7 @@ static struct timeval data_send_barrier;
 static struct timeval eof_barrier;
 
 extern struct misc_meta_data *mmd;
-extern struct audio_file_selector dblist[];
+extern struct audio_file_selector selectors[];
 extern struct sender senders[];
 extern struct gengetopt_args_info conf;
 
@@ -233,7 +233,7 @@ static int update_mmd(void)
 
 static void get_song(void)
 {
-       char **sl = dblist[mmd->selector_num].get_audio_file_list(10);
+       char **sl = selectors[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->selector_num].update_audio_file)
-                       dblist[mmd->selector_num].update_audio_file(sl[i]);
+               if (selectors[mmd->selector_num].update_audio_file)
+                       selectors[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 030289af8444ac35baddb8e10b30712a542768c9..3b92be657bd28b49ca690923583d2b42cb5dd770 100644 (file)
--- a/command.c
+++ b/command.c
@@ -44,7 +44,7 @@ static unsigned char rc4_buf[2 * RC4_KEY_LEN];
 extern const char *status_item_list[NUM_STAT_ITEMS];
 extern struct misc_meta_data *mmd;
 extern struct gengetopt_args_info conf;
-extern struct audio_file_selector dblist[];
+extern struct audio_file_selector selectors[];
 extern struct audio_format afl[];
 extern struct sender senders[];
 extern char *user_list;
@@ -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->selector_num].name,
+               status_item_list[SI_SELECTOR], selectors[nmmd->selector_num].name,
 
                status_item_list[SI_OFFSET], offset,
                status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format),
@@ -559,15 +559,15 @@ static int com_si(int fd, int argc, __unused char **argv)
 {
        int i, ret;
        char *ut;
-       char *selectors = NULL, *sender_info = NULL, *sender_list = NULL;
+       char *selector_string = NULL, *sender_info = NULL, *sender_list = NULL;
        struct mallinfo mi = mallinfo();
 
        if (argc)
                return -E_COMMAND_SYNTAX;
        mmd_lock();
-       for (i = 0; dblist[i].name; i++) {
-               selectors = para_strcat(selectors, dblist[i].name);
-               selectors = para_strcat(selectors, " ");
+       for (i = 0; selectors[i].name; i++) {
+               selector_string = para_strcat(selector_string, selectors[i].name);
+               selector_string = para_strcat(selector_string, " ");
        }
        for (i = 0; senders[i].name; i++) {
                char *info = senders[i].info();
@@ -593,14 +593,14 @@ static int com_si(int fd, int argc, __unused char **argv)
                mmd->num_commands,
                mmd->num_connects,
                conf.loglevel_arg,
-               selectors,
+               selector_string,
                SUPPORTED_AUDIO_FORMATS,
                sender_list,
                sender_info
        );
        mmd_unlock();
        free(ut);
-       free(selectors);
+       free(selector_string);
        free(sender_list);
        free(sender_info);
        return ret;
@@ -735,8 +735,8 @@ static struct server_command *get_cmd_ptr(char *name, char **handler)
        mmd_lock();
        if (handler)
                *handler = make_message("the %s selector",
-                       dblist[mmd->selector_num].name);
-       cmd = dblist[mmd->selector_num].cmd_list;
+                       selectors[mmd->selector_num].name);
+       cmd = selectors[mmd->selector_num].cmd_list;
        mmd_unlock();
        for (; cmd->name; cmd++)
                if (!strcmp(cmd->name, name))
@@ -756,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->selector_num].name);
-               cmd = dblist[mmd->selector_num].cmd_list;
+               handler = para_strdup(selectors[mmd->selector_num].name);
+               cmd = selectors[mmd->selector_num].cmd_list;
                mmd_unlock();
                ret = send_description(fd, cmd, handler, 0);
                free(handler);
@@ -855,14 +855,14 @@ static int com_chs(int fd, int argc, char **argv)
        if (!argc) {
                char *selector;
                mmd_lock();
-               selector = para_strdup(dblist[mmd->selector_num].name);
+               selector = para_strdup(selectors[mmd->selector_num].name);
                mmd_unlock();
                ret = send_va_buffer(fd, "%s\n", selector);
                free(selector);
                return ret;
        }
-       for (i = 0; dblist[i].name; i++) {
-               if (strcmp(dblist[i].name, argv[1]))
+       for (i = 0; selectors[i].name; i++) {
+               if (strcmp(selectors[i].name, argv[1]))
                        continue;
                mmd_lock();
                mmd->selector_change = i;
index 8c9b48a6e371e27bad84baaa482556a4fda45550..8f20763fb44ed01327514b92837dceb8b0f66021 100644 (file)
--- a/server.c
+++ b/server.c
@@ -63,7 +63,7 @@ extern void ortp_send_init(struct sender *);
 extern struct audio_format afl[];
 
 /** the list of supported audio file selectors */
-struct audio_file_selector dblist[] = {
+struct audio_file_selector selectors[] = {
        {
                .name = "random",
                .init = random_selector_init,
@@ -289,12 +289,12 @@ static void init_selector(void)
        mmd->selector_change = -1; /* no change nec., set to new num by com_chs */
        if (!conf.selector_given)
                goto random;
-       for (i = 0; dblist[i].name; i++) {
-               if (strcmp(dblist[i].name, conf.selector_arg))
+       for (i = 0; selectors[i].name; i++) {
+               if (strcmp(selectors[i].name, conf.selector_arg))
                        continue;
                PARA_NOTICE_LOG("initializing %s audio file selector\n",
-                       dblist[i].name);
-               ret = dblist[i].init(&dblist[i]);
+                       selectors[i].name);
+               ret = selectors[i].init(&selectors[i]);
                if (ret < 0) {
                        PARA_WARNING_LOG("%s", PARA_STRERROR(-ret));
                        break;
@@ -305,7 +305,7 @@ static void init_selector(void)
        PARA_WARNING_LOG("%s", "falling back to the random selector\n");
 random:
        mmd->selector_num = 0;
-       dblist[0].init(&dblist[0]); /* always successful */
+       selectors[0].init(&selectors[0]); /* always successful */
 }
 
 static unsigned init_network(void)
@@ -379,8 +379,8 @@ static void change_selector(void)
 {
        int ret, old = mmd->selector_num, new = mmd->selector_change;
 
-       dblist[old].shutdown();
-       ret = dblist[new].init(&dblist[new]);
+       selectors[old].shutdown();
+       ret = selectors[new].init(&selectors[new]);
        mmd->selector_change = -1; /* reset */
        if (ret >= 0) {
                mmd->selector_num = new;
@@ -388,7 +388,7 @@ static void change_selector(void)
        }
        /* init failed */
        PARA_ERROR_LOG("%s -- switching to the random selector\n", PARA_STRERROR(-ret));
-       dblist[0].init(&dblist[0]);
+       selectors[0].init(&selectors[0]);
        mmd->selector_num = 0;
 }
 
@@ -464,8 +464,8 @@ repeat:
                        &max_fileno,
                        &rfds, &wfds);
        }
-       if (dblist[mmd->selector_num].pre_select) {
-               ret = dblist[mmd->selector_num].pre_select(&rfds, &wfds);
+       if (selectors[mmd->selector_num].pre_select) {
+               ret = selectors[mmd->selector_num].pre_select(&rfds, &wfds);
                max_fileno = MAX(max_fileno, ret);
        }
        mmd_unlock();
@@ -476,8 +476,8 @@ repeat:
        mmd_lock();
        if (mmd->selector_change >= 0)
                change_selector();
-       if (dblist[mmd->selector_num].post_select)
-               dblist[mmd->selector_num].post_select(&rfds, &wfds);
+       if (selectors[mmd->selector_num].post_select)
+               selectors[mmd->selector_num].post_select(&rfds, &wfds);
        if (ret < 0 && err == EINTR)
                goto repeat;
        if (ret < 0) {
@@ -512,7 +512,7 @@ repeat:
                case SIGTERM:
                        PARA_EMERG_LOG("terminating on signal %d\n", sig);
                        kill(0, SIGTERM);
-                       dblist[mmd->selector_num].shutdown();
+                       selectors[mmd->selector_num].shutdown();
                        mutex_destroy(mmd_mutex);
                        shm_detach(mmd);
                        shm_destroy(mmd_shm_id);