From 42f84167d46f8c91b5b9c6bc3471b9c21f623c97 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 26 May 2025 20:38:37 +0200 Subject: [PATCH] Shrink struct rmatt_event_data. The aft event handler needs to know the bit number of the attribute which is being removed in order to clear the bit in the afs info structure of each row of the audio file table. The handler does not need to know the attribute's name, though, and remove_attribute() already prints it, so remove this field from the event data structure. --- afs.h | 4 +--- aft.c | 5 ++--- attribute.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/afs.h b/afs.h index b46aeed1..7129af88 100644 --- a/afs.h +++ b/afs.h @@ -59,9 +59,7 @@ enum afs_events { * Used as data for \ref afs_event() for events of type \p ATTRIBUTE_ADD. */ struct rmatt_event_data { - /** The name of the attribute being added. */ - const char *name; - /** Its bit number. */ + /** The bit number of the attribute being removed. */ unsigned char bitnum; }; diff --git a/aft.c b/aft.c index 8abfbc94..dd99a31e 100644 --- a/aft.c +++ b/aft.c @@ -2666,9 +2666,8 @@ static int aft_event_handler(enum afs_events event, struct para_buffer *pb, switch (event) { case ATTRIBUTE_REMOVE: { const struct rmatt_event_data *red = data; - para_printf(pb, "clearing attribute %s (bit %u) from all " - "entries in the audio file table\n", red->name, - red->bitnum); + para_printf(pb, "clearing bit #%u from all entries in the " \ + "audio file table\n", red->bitnum); return audio_file_loop(data, clear_attribute); } case AFSI_CHANGE: { struct afsi_change_event_data *aced = data; diff --git a/attribute.c b/attribute.c index 0496641c..6a0c6370 100644 --- a/attribute.c +++ b/attribute.c @@ -292,7 +292,7 @@ static int remove_attribute(struct osl_table *table, struct osl_row *row, { struct afs_callback_arg *aca = data; int ret; - struct rmatt_event_data red = {.name = name}; + struct rmatt_event_data red; ret = get_attribute_bitnum_by_name(name, &red.bitnum); if (ret < 0) { -- 2.39.5