[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/charset.h,v
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/src/charset.h,v |
Date: |
Fri, 22 Sep 2006 17:30:03 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 06/09/22 17:30:03
Index: charset.h
===================================================================
RCS file: /sources/emacs/emacs/src/charset.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- charset.h 29 May 2006 06:19:09 -0000 1.83
+++ charset.h 22 Sep 2006 17:30:02 -0000 1.84
@@ -658,22 +658,34 @@
} while (0)
-/* If P is after LIMIT, advance P to the previous character boundary.
- It assumes that P is already at a character boundary of the sane
- mulitbyte form whose beginning address is LIMIT. */
+/* If P is after LIMIT, advance P to the previous character boundary. */
#define PREV_CHAR_BOUNDARY(p, limit) \
do { \
if ((p) > (limit)) \
{
\
const unsigned char *p0 = (p); \
+ const unsigned char *p_limit = max (limit, p0 - MAX_MULTIBYTE_LENGTH);\
do { \
p0--; \
- } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \
- (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \
+ } while (p0 >= p_limit && ! CHAR_HEAD_P (*p0)); \
+ /* If BBCH(*p0) > p-p0, it means we were not on a boundary. */ \
+ (p) = (BYTES_BY_CHAR_HEAD (*p0) >= (p) - p0) ? p0 : (p) - 1; \
}
\
} while (0)
+#define AT_CHAR_BOUNDARY_P(result, p, limit) \
+ do { \
+ if (CHAR_HEAD_P (*(p)) || (p) <= limit) \
+ /* Optimization for the common case. */ \
+ (result) = 1; \
+ else \
+ { \
+ const unsigned char *p_aux = (p)+1; \
+ PREV_CHAR_BOUNDARY (p_aux, limit); \
+ (result) = (p_aux == (p)); \
+ } \
+} while (0)
#ifdef emacs
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/charset.h,v,
Stefan Monnier <=