]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/list-cleanups'
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 15 Nov 2021 18:31:41 +0000 (19:31 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 15 Nov 2021 18:33:21 +0000 (19:33 +0100)
A bunch of simple patches which streamline the macros and inline
functions of list.h which were taken from linux long ago without
adjusting the coding style.

Cooking for three months.

* refs/heads/t/list-cleanups:
  list.h: Convert INIT_LIST_HEAD macro to inline function.
  list.h: Fix parameter doc of iterators.
  list.h: Move list_is_singular() up.
  list.h: Rename argument of list_move().
  list.h: Don't use "new" as an variable name.
  list.h: Open-code LIST_POISON1 and LIST_POISON2.
  list.h: Get rid of internal helpers.
  list.h: Trivial cleanups.
  list.h: Remove unused list_for_each_entry_safe_reverse.

1  2 
NEWS.md
afs.c
sync_filter.c
udp_send.c
vss.c

diff --combined NEWS.md
index 76e00d3d166f71a4f98432464b87f937bc28ceaf,3e3e7abfda28365cba7abfa2ead1c2c408d75801..809da10ac55292f9dfc8fb443eb1c5a43d84fd15
+++ b/NEWS.md
@@@ -1,54 -1,6 +1,55 @@@
  NEWS
  ====
  
 +---------------------------------------
 +0.7.0 (to be announced) "seismic orbit"
 +---------------------------------------
 +
 +- Paraslash writers handle early end-of-file more gracefully.
 +- The alsa writer no longer warns about spurious underruns.
++- Cleanups of the doubly linked lists code.
 +
 +--------------------------------------
 +0.6.4 (2021-11-04) "fuzzy calibration"
 +--------------------------------------
 +
 +This point release contains a fair number of fixes but no new features.
 +This marks the end of the 0.6 development, although paraslash-0.6 will
 +still be supported for some time and subsequent maintenance releases
 +may follow.
 +
 +- The udp sender no longer crashes when empty chunks are encountered.
 +- Fix a double-free bug in the exit path of the server.
 +- The "jmp" command now errors out when given a negative percentage.
 +- A fix for a bug in para_afh which triggered on the attempt to modify
 +  the tags of an invalid mp4 file.
 +- A memory leak in para_afh has been fixed.
 +- The udp sender no longer sends multiple EOF packets.
 +- Some gcc warnings have been silenced.
 +- Minor log level adjustments and documentation improvements.
 +
 +Downloads:
 +[tarball](./releases/paraslash-0.6.4.tar.xz),
 +[signature](./releases/paraslash-0.6.4.tar.xz.asc)
 +
 +---------------------------------------
 +0.5.9 (2021-11-04) "reversed dimension"
 +---------------------------------------
 +
 +This release contains a few important fixes which have accumulated in
 +the maint branch. The paraslash-0.5.x series has now reached its end
 +of life and will no longer be supported. All users should upgrade to
 +a more recent version at this point.
 +
 +- Fix an issue with the bash completion script.
 +- Initialize the random seed also when using libgrypt.
 +- Fix some compiler warnings in the resample filter
 +- Don't return spurious errors from the ff server command.
 +
 +Downloads:
 +[tarball](./releases/paraslash-0.5.9.tar.bz2),
 +[signature](./releases/paraslash-0.5.9.tar.bz2.asc)
 +
  ----------------------------------------
  0.6.3 (2021-02-18) "generalized activity"
  -----------------------------------------
diff --combined afs.c
index b6cce36f42e30cd5672d7e5cc9934cc2d659ca8f,a219c2dd1eb1b10744ee15381560fc7cd2fe3039..3d86d1925e97517ee1222d9b3b04f46f541cc688
--- 1/afs.c
--- 2/afs.c
+++ b/afs.c
@@@ -418,13 -418,13 +418,13 @@@ static int pass_afd(int fd, char *buf, 
   */
  static int open_next_audio_file(void)
  {
 -      struct audio_file_data afd;
 -      int ret, shmid;
 +      int ret, shmid, fd;
        char buf[8];
  
 -      ret = open_and_update_audio_file(&afd);
 +      ret = open_and_update_audio_file(&fd);
        if (ret < 0) {
 -              PARA_ERROR_LOG("%s\n", para_strerror(-ret));
 +              if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
 +                      PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                goto no_admissible_files;
        }
        shmid = ret;
        }
        *(uint32_t *)buf = NEXT_AUDIO_FILE;
        *(uint32_t *)(buf + 4) = (uint32_t)shmid;
 -      ret = pass_afd(afd.fd, buf, 8);
 -      close(afd.fd);
 +      ret = pass_afd(fd, buf, 8);
 +      close(fd);
        if (ret >= 0)
                return ret;
  destroy:
@@@ -981,7 -981,7 +981,7 @@@ __noreturn void afs_init(int socket_fd
        int i, ret;
  
        register_signal_task(&s);
-       INIT_LIST_HEAD(&afs_client_list);
+       init_list_head(&afs_client_list);
        for (i = 0; i < NUM_AFS_TABLES; i++)
                afs_tables[i].init(&afs_tables[i]);
        ret = open_afs_tables();
diff --combined sync_filter.c
index f23545adb68342322fbeaef4c45c73c663a969be,13bbcf1b9b7bfa18ab4c7606f5ff5cc4f5863503..8e9ff2c5de79a6385b6472453f3dec417b9ac5cc
@@@ -103,7 -103,7 +103,7 @@@ static void sync_open(struct filter_nod
        const struct lls_opt_result *r_b;
  
        ctx = fn->private_data = para_calloc(sizeof(*ctx));
-       INIT_LIST_HEAD(&ctx->buddies);
+       init_list_head(&ctx->buddies);
  
        /* create socket to listen for incoming packets */
        ret = makesock(
@@@ -365,8 -365,7 +365,8 @@@ success
        ret = -E_SYNC_COMPLETE; /* success */
        goto out;
  fail:
 -      PARA_WARNING_LOG("%s\n", para_strerror(-ret));
 +      if (ret != -E_BTR_EOF)
 +              PARA_WARNING_LOG("%s\n", para_strerror(-ret));
  out:
        sync_close_buddies(ctx);
        btr_splice_out_node(&fn->btrn);
diff --combined udp_send.c
index 96a25d370a99d3fdcb6782ef9451ae86b1cfc3a4,be161a86c166f26779e015720612a452925704c6..91550aa8c66836239df07193d46d5d470612767e
@@@ -56,8 -56,6 +56,8 @@@ static void udp_close_target(struct sen
        size_t len;
        struct udp_target *ut = sc->private_data;
  
 +      if (process_is_command_handler())
 +              return;
        if (ut->sent_fec_eof)
                return;
        PARA_NOTICE_LOG("sending FEC EOF\n");
@@@ -394,7 -392,7 +394,7 @@@ static void udp_init_target_list(void
        struct sender_command_data scd;
        int i;
  
-       INIT_LIST_HEAD(&targets);
+       init_list_head(&targets);
        for (i = 0; i < OPT_GIVEN(UDP_TARGET); i++) {
                const char *arg = lls_string_val(i, OPT_RESULT(UDP_TARGET));
                if (udp_resolve_target(arg, &scd) < 0)
@@@ -427,7 -425,7 +427,7 @@@ static char *udp_help(void
  /* Initialize the list of udp targets. */
  static void udp_send_init(void)
  {
-       INIT_LIST_HEAD(&targets);
+       init_list_head(&targets);
        sender_status = SENDER_off;
        udp_init_target_list();
        if (!OPT_GIVEN(UDP_NO_AUTOSTART))
diff --combined vss.c
index 9969a150ee63291e182f058664af9178eabf77f3,ad5f7ec0db6886894a90f32b4c5adf444871ddf0..9e2e32ca3b3bd7979b3c564ff1959dcbe7560446
--- 1/vss.c
--- 2/vss.c
+++ b/vss.c
@@@ -416,8 -416,7 +416,8 @@@ static int compute_group_size(struct vs
                g->bytes += len;
                g->num_chunks++;
        }
 -      assert(g->num_chunks);
 +      if (g->num_chunks == 0)
 +              return -E_EOF;
        PARA_DEBUG_LOG("group #%u: %u chunks, %u bytes total\n", g->num,
                g->num_chunks, g->bytes);
        return 1;
@@@ -965,11 -964,6 +965,11 @@@ static void recv_afs_result(struct vss_
        if (ret < 0)
                goto err;
        vsst->afsss = AFS_SOCKET_READY;
 +      if (afs_code == NO_ADMISSIBLE_FILES) {
 +              PARA_NOTICE_LOG("no admissible files\n");
 +              ret = 0;
 +              goto err;
 +      }
        ret = -E_NOFD;
        if (afs_code != NEXT_AUDIO_FILE) {
                PARA_ERROR_LOG("afs code: %u, expected: %d\n", afs_code,
        return;
  err:
        free(mmd->afd.afhi.chunk_table);
 +      mmd->afd.afhi.chunk_table = NULL;
        if (passed_fd >= 0)
                close(passed_fd);
 -      PARA_ERROR_LOG("%s\n", para_strerror(-ret));
 +      if (ret < 0)
 +              PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        mmd->new_vss_status_flags = VSS_NEXT;
  }
  
@@@ -1178,7 -1170,7 +1178,7 @@@ void vss_init(int afs_socket, struct sc
        vsst->afs_socket = afs_socket;
        ms2tv(announce_time, &vsst->announce_tv);
        PARA_INFO_LOG("announce timeval: %lums\n", tv2ms(&vsst->announce_tv));
-       INIT_LIST_HEAD(&fec_client_list);
+       init_list_head(&fec_client_list);
        FOR_EACH_SENDER(i) {
                PARA_NOTICE_LOG("initializing %s sender\n", senders[i]->name);
                senders[i]->init();