aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.h
diff options
context:
space:
mode:
authorPaul Eggert2011-03-15 00:04:00 -0700
committerPaul Eggert2011-03-15 00:04:00 -0700
commit15206ed9236f4957cb62a0cfbd5397cf8f0cb76b (patch)
treec5b79dc24fd900342aaed46555ef28480014f502 /src/character.h
parent4a6bea268fbac2fd64018374652f5b2c9b04b4fd (diff)
downloademacs-15206ed9236f4957cb62a0cfbd5397cf8f0cb76b.tar.gz
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.h3
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/>. */
128 XSETCDR ((x), tmp); \ 128 XSETCDR ((x), tmp); \
129 } while (0) 129 } while (0)
130 130
131/* Nonzero iff C is an ASCII character. */
132#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80)
133
134/* Nonzero iff C is a character of code less than 0x100. */ 131/* Nonzero iff C is a character of code less than 0x100. */
135#define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) 132#define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100)
136 133