From eb91ad54efab00503698927bdd1758b12769d9c1 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 15 May 2014 13:11:55 +0000 Subject: [PATCH] Improving two comments, and eliding a macro. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4891 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/nano.h | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c344eb1..58db47e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2014-05-15 Benno Schulenberg * 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 * src/winio.c (edit_draw): Poke a non-breaking space into the last diff --git a/src/nano.h b/src/nano.h index db249eef..a1da639a 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,