Change type of struct osl_table_description->flags to uint8_t.
authorAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 15:45:39 +0000 (17:45 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 15:45:39 +0000 (17:45 +0200)
We reserve only one byte in the index header of the table, so it
does not make sense to have this field of type enum.

Fixes:

fsck.c:815: warning: dereferencing type-punned pointer will break strict-aliasing rules

fsck.c
osl.h.in

diff --git a/fsck.c b/fsck.c
index 29c4e2c..27004a6 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -754,7 +754,7 @@ static unsigned files_pruned;
 int prune_disk_storage_file(const char *path, void *private_data)
 {
        HASH_TYPE hash[HASH_SIZE];
-       unsigned flags = *(unsigned *)private_data;
+       uint8_t flags = *(uint8_t *)private_data;
        struct osl_object obj = {.data = hash, .size = HASH_SIZE};
        struct osl_row *row;
        int ret = -1;
@@ -811,8 +811,9 @@ static int prune_disk_storage_files(struct osl_table *t)
        INFO_LOG("looking for unreferenced disk storage files\n");
        FOR_EACH_DISK_STORAGE_COLUMN(i, t, cd) {
                char *dirname = column_filename(t, i);
+               uint8_t flags = t->desc->flags;
                ret = for_each_file_in_dir(dirname, prune_disk_storage_file,
-                       (unsigned *)&t->desc->flags);
+                       &flags);
                free(dirname);
        }
        if (files_pruned)
index 514baa2..e462479 100644 (file)
--- a/osl.h.in
+++ b/osl.h.in
@@ -135,8 +135,8 @@ struct osl_table_description {
        const char *name;
        /** The number of columns of this table. */
        uint16_t num_columns;
-       /** Further table-wide information. */
-       enum osl_table_flags flags;
+       /** Further table-wide information, \sa osl_table_flags. */
+       uint8_t flags;
        /** The array describing the individual columns of the table. */
        struct osl_column_description *column_descriptions;
 };