]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
aft: Simplify print_list_item().
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 23 Mar 2025 14:52:03 +0000 (15:52 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 7 Apr 2025 14:11:49 +0000 (16:11 +0200)
The function performs no cleanup, so we don't need to jump to "out"
just to return ret.

aft.c

diff --git a/aft.c b/aft.c
index 2fab49b5c627b65635a02259df144e7ac9ade0c6..3e786a000bf31c4b6055438b1b22e3d18ebfc81e 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -843,13 +843,10 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
 
        if (opts->mode == LS_MODE_SHORT) {
                para_printf(b, "%s\n", d->path);
-               ret = 1;
-               goto out;
-       }
-       if (opts->mode == LS_MODE_CHUNKS) {
-               ret = print_chunk_table(d, b);
-               goto out;
+               return 1;
        }
+       if (opts->mode == LS_MODE_CHUNKS)
+               return print_chunk_table(d, b);
        get_attribute_bitmap(&afsi->attributes, att_buf);
        if (lls_opt_given(r_d))
                sprintf(last_played_time, "%llu",
@@ -858,7 +855,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                ret = get_local_time(&afsi->last_played, last_played_time,
                        sizeof(last_played_time), current_time, opts->mode);
                if (ret < 0)
-                       goto out;
+                       return ret;
        }
        get_duration_buf(afhi->seconds_total, duration_buf,
                sizeof(duration_buf), opts);
@@ -894,8 +891,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        last_played_time,
                        d->path
                );
-               ret = 1;
-               goto out;
+               return 1;
        }
        if (opts->mode == LS_MODE_MBOX) {
                const char *slash = strrchr(d->path, '/');
@@ -911,7 +907,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                WRITE_STATUS_ITEM(b, SI_score, "%li\n", d->score);
        ret = write_attribute_items(b, att_buf, afsi);
        if (ret < 0)
-               goto out;
+               return ret;
        write_image_items(b, afsi);
        write_lyrics_items(b, afsi);
        hash2_to_asc(d->hash, asc_hash);
@@ -947,8 +943,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        osl_close_disk_object(&lyrics_def);
                }
        }
-out:
-       return ret;
+       return 1;
 }
 
 static void make_inode_status_items(struct para_buffer *pb)