]> git.tuebingen.mpg.de Git - osl.git/commitdiff
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 29c4e2c7dc9d72d940dbb7c4298f24d84f3dcfc8..27004a65694131b020d527177a9269ec2711f2ed 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 514baa2ed576608c3f0a6b7607e5df68ad1eaccb..e4624799d12999044bdb1e2bdaa4b0add6de8374 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;
 };