diff --git a/ChangeLog b/ChangeLog index 5c344eb1bb3a8f3a0ce7b90f107a916b9b15c9d0..58db47e476166e6961e6112c3baee9eae624bb94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2014-05-15 Benno Schulenberg <bensberg@justemail.net> * doc/syntax/c.nanorc: Improve the magic regex, plus tweaks. * src/color.c (color_update): Adjust comment, and be clear. + * src/nano.h: Improve two comments, and elide one macro. 2014-05-14 Benno Schulenberg <bensberg@justemail.net> * src/winio.c (edit_draw): Poke a non-breaking space into the last diff --git a/src/nano.h b/src/nano.h index db249eef7b9f7e695a52e83534c8cea35f76043a..a1da639a72206a46361fc15151fd68468632d6fc 100644 --- a/src/nano.h +++ b/src/nano.h @@ -57,10 +57,9 @@ /* Suppress warnings for __attribute__((warn_unused_result)). */ #define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0) -/* Macros for flags. */ -#define FLAGOFF(flag) ((flag) / (sizeof(unsigned) * 8)) +/* Macros for flags, indexing each bit in a small array. */ +#define FLAGS(flag) flags[((flag) / (sizeof(unsigned) * 8))] #define FLAGMASK(flag) (1 << ((flag) % (sizeof(unsigned) * 8))) -#define FLAGS(flag) flags[FLAGOFF(flag)] #define SET(flag) FLAGS(flag) |= FLAGMASK(flag) #define UNSET(flag) FLAGS(flag) &= ~FLAGMASK(flag) #define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0) @@ -497,8 +496,7 @@ enum NUMBER_OF_ELEMENTS }; -/* Enumeration to be used in flags table. See FLAGBIT and FLAGOFF - * definitions. */ +/* Enumeration used in the flags array. See the definition of FLAGMASK. */ enum { DONTUSE,