]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Shrink struct rmatt_event_data.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 26 May 2025 18:38:37 +0000 (20:38 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 28 May 2025 17:23:40 +0000 (19:23 +0200)
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
aft.c
attribute.c

diff --git a/afs.h b/afs.h
index b46aeed1e9c107405cc717dfed236309ef551763..7129af88f4c4e8bd23a9dab987c7e02cb71f6d0b 100644 (file)
--- 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 8abfbc94fe5a9afd7352528987d8e453f33228c4..dd99a31ebc295106980318cadf4ccc1c66ffb6b7 100644 (file)
--- 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;
index 0496641c3eaa36a57d7cb98d8787a44e56440e48..6a0c6370faaf58fe7f0f8254f86c97dc8138aeed 100644 (file)
@@ -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) {