From 4b81f5ca920d716c08430583f5edb2c125f1f123 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 14 Jul 2013 19:18:21 -0400 Subject: Modify the update_status field in struct file to be an enum. Makes the code a little clearer/cleaner, and solves a problem on systems where a char is unsigned by default. --- filedef.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'filedef.h') diff --git a/filedef.h b/filedef.h index 73dc037..f458551 100644 --- a/filedef.h +++ b/filedef.h @@ -59,11 +59,16 @@ struct file FILE_TIMESTAMP mtime_before_update; /* File's modtime before any updating has been performed. */ int command_flags; /* Flags OR'd in for cmds; see commands.h. */ - char update_status; /* Status of the last attempt to update, - or -1 if none has been made. */ + enum update_status /* Status of the last attempt to update. */ + { + us_success = 0, /* Successfully updated. Must be 0! */ + us_none, /* No attempt to update has been made. */ + us_question, /* Needs to be updated (-q is is set). */ + us_failed /* Update failed. */ + } update_status ENUM_BITFIELD (2); enum cmd_state /* State of the commands. */ - { /* Note: It is important that cs_not_started be zero. */ - cs_not_started, /* Not yet started. */ + { + cs_not_started = 0, /* Not yet started. Must be 0! */ cs_deps_running, /* Dep commands running. */ cs_running, /* Commands running. */ cs_finished /* Commands finished. */ -- cgit v1.2.3