From 49e420a1525fa40fcf4301671755c4a534f13c5f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 23 Mar 2025 15:52:03 +0100 Subject: [PATCH] aft: Simplify print_list_item(). The function performs no cleanup, so we don't need to jump to "out" just to return ret. --- aft.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/aft.c b/aft.c index 2fab49b5..3e786a00 100644 --- 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) -- 2.39.5