diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-15 00:04:00 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-15 00:04:00 -0700 |
commit | 15206ed9236f4957cb62a0cfbd5397cf8f0cb76b (patch) | |
tree | c5b79dc24fd900342aaed46555ef28480014f502 /src/character.h | |
parent | 4a6bea268fbac2fd64018374652f5b2c9b04b4fd (diff) | |
download | emacs-15206ed9236f4957cb62a0cfbd5397cf8f0cb76b.tar.gz emacs-15206ed9236f4957cb62a0cfbd5397cf8f0cb76b.tar.bz2 emacs-15206ed9236f4957cb62a0cfbd5397cf8f0cb76b.zip |
Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
dired.c's scmp function, had undefined behavior.
* lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
(NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
* buffer.h: ... to here, because these macros use current_buffer,
and the new implementation with inline functions needs to have
current_buffer in scope now, rather than later when the macros
are used.
(downcase, upcase1): New static inline functions.
(DOWNCASE, UPCASE1): Reimplement using these functions.
This avoids undefined behavior in expressions like
DOWNCASE (x) == DOWNCASE (y), which previously suffered
from race conditions in accessing the global variables
case_temp1 and case_temp2.
* casetab.c (case_temp1, case_temp2): Remove; no longer needed.
* lisp.h (case_temp1, case_temp2): Remove their decls.
* character.h (ASCII_CHAR_P): Move from here ...
* lisp.h: ... to here, so that the inline functions mentioned
above can use them.
Diffstat (limited to 'src/character.h')
-rw-r--r-- | src/character.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/src/character.h b/src/character.h index d29ab41557b..6d5b8110109 100644 --- a/src/character.h +++ b/src/character.h @@ -128,9 +128,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ XSETCDR ((x), tmp); \ } while (0) -/* Nonzero iff C is an ASCII character. */ -#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80) - /* Nonzero iff C is a character of code less than 0x100. */ #define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) |