summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-11-21 11:52:23 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2009-11-21 11:52:23 +0000
commit62a6e103dd7b9d940565639d6a47c8bdee3f24ce (patch)
tree0e2ab8777e97932d73a91e328683bef10dbf7c8d /src
parentc3b616a940d9dab7f8fe4376755a8a8f9a2ba290 (diff)
downloademacs-62a6e103dd7b9d940565639d6a47c8bdee3f24ce.tar.gz
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
ignored second argument. All callers changed. * regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR) (RE_STRING_CHAR_AND_LENGTH): Likewise. * xdisp.c (string_char_and_length): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c2
-rw-r--r--src/buffer.h4
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/character.c6
-rw-r--r--src/character.h20
-rw-r--r--src/composite.c8
-rw-r--r--src/data.c3
-rw-r--r--src/doc.c6
-rw-r--r--src/editfns.c9
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c12
-rw-r--r--src/font.c2
-rw-r--r--src/indent.c2
-rw-r--r--src/insdel.c2
-rw-r--r--src/lread.c6
-rw-r--r--src/print.c10
-rw-r--r--src/process.c2
-rw-r--r--src/regex.c51
-rw-r--r--src/search.c14
-rw-r--r--src/syntax.c23
-rw-r--r--src/xdisp.c35
-rw-r--r--src/xterm.c3
23 files changed, 107 insertions, 125 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 452cee484f2..7f6891e0710 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2009-11-21 Andreas Schwab <schwab@linux-m68k.org>
+
+ * character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
+ ignored second argument. All callers changed.
+ * regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR)
+ (RE_STRING_CHAR_AND_LENGTH): Likewise.
+ * xdisp.c (string_char_and_length): Likewise.
+
2009-11-21 Dan Nicolaescu <dann@ics.uci.edu>
* xterm.c (x_new_font):
diff --git a/src/buffer.c b/src/buffer.c
index 8edea2d8728..8657fd8cdff 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2409,7 +2409,7 @@ current buffer is cleared. */)
p++, pos++;
else if (CHAR_BYTE8_HEAD_P (*p))
{
- c = STRING_CHAR_AND_LENGTH (p, stop - pos, bytes);
+ c = STRING_CHAR_AND_LENGTH (p, bytes);
/* Delete all bytes for this 8-bit character but the
last one, and change the last one to the charcter
code. */
diff --git a/src/buffer.h b/src/buffer.h
index 2a04f49ea48..9f57a292053 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -330,7 +330,7 @@ extern unsigned char *_fetch_multibyte_char_p;
#define FETCH_MULTIBYTE_CHAR(pos) \
(_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) \
+ (pos) + BEG_ADDR - BEG_BYTE), \
- STRING_CHAR (_fetch_multibyte_char_p, 0))
+ STRING_CHAR (_fetch_multibyte_char_p))
/* Return character at position POS. If the current buffer is unibyte
and the character is not ASCII, make the returning character
@@ -389,7 +389,7 @@ extern unsigned char *_fetch_multibyte_char_p;
(_fetch_multibyte_char_p \
= (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0) \
+ (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE), \
- STRING_CHAR (_fetch_multibyte_char_p, 0))
+ STRING_CHAR (_fetch_multibyte_char_p))
/* Define the actual buffer data structures. */
diff --git a/src/casefiddle.c b/src/casefiddle.c
index f9f19927313..9963c1e90c5 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -133,7 +133,7 @@ casify_object (flag, obj)
bcopy (old_dst, dst, o - old_dst);
o = dst + (o - old_dst);
}
- c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, 0, len);
+ c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
if (inword && flag != CASE_CAPITALIZE_UP)
c = DOWNCASE (c);
else if (!UPPERCASEP (c)
diff --git a/src/character.c b/src/character.c
index ff2f4a716d8..396a9c2728d 100644
--- a/src/character.c
+++ b/src/character.c
@@ -405,7 +405,7 @@ c_string_width (const unsigned char *str, int len, int precision, int *nchars, i
{
int bytes, thiswidth;
Lisp_Object val;
- int c = STRING_CHAR_AND_LENGTH (str + i_byte, len - i_byte, bytes);
+ int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
if (dp)
{
@@ -495,7 +495,7 @@ lisp_string_width (string, precision, nchars, nbytes)
int c;
if (multibyte)
- c = STRING_CHAR_AND_LENGTH (str + i_byte, len - i_byte, bytes);
+ c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
else
c = str[i_byte], bytes = 1;
chars = 1;
@@ -1061,7 +1061,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */)
if (! STRING_MULTIBYTE (string))
return make_number (*p);
}
- c = STRING_CHAR (p, 0);
+ c = STRING_CHAR (p);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (! ASCII_CHAR_P (c))
diff --git a/src/character.h b/src/character.h
index 78065597532..77c1d8cded2 100644
--- a/src/character.h
+++ b/src/character.h
@@ -311,10 +311,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
} while (0)
/* Return the character code of character whose multibyte form is at
- P. The argument LEN is ignored. It will be removed in the
- future. */
+ P. */
-#define STRING_CHAR(p, len) \
+#define STRING_CHAR(p) \
(!((p)[0] & 0x80) \
? (p)[0] \
: ! ((p)[0] & 0x20) \
@@ -329,10 +328,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte
- form. The argument LEN is ignored. It will be removed in the
- future. */
+ form. */
-#define STRING_CHAR_AND_LENGTH(p, len, actual_len) \
+#define STRING_CHAR_AND_LENGTH(p, actual_len) \
(!((p)[0] & 0x80) \
? ((actual_len) = 1, (p)[0]) \
: ! ((p)[0] & 0x20) \
@@ -382,7 +380,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
- OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
+ OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \
BYTEIDX += len; \
} \
else \
@@ -405,7 +403,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
- OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
+ OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \
BYTEIDX += len; \
} \
else \
@@ -426,7 +424,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
int len; \
\
- OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len); \
+ OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \
BYTEIDX += len; \
CHARIDX++; \
} \
@@ -445,7 +443,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
int len; \
\
- OUTPUT= STRING_CHAR_AND_LENGTH (ptr, 0, len); \
+ OUTPUT= STRING_CHAR_AND_LENGTH (ptr, len); \
BYTEIDX += len; \
} \
else \
@@ -465,7 +463,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
int len; \
\
- OUTPUT= STRING_CHAR_AND_LENGTH (ptr, 0, len); \
+ OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \
BYTEIDX += len; \
CHARIDX++; \
} \
diff --git a/src/composite.c b/src/composite.c
index f7bfc28973a..33dd4ba1abd 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1321,7 +1321,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
retry:
check_val = Qnil;
/* At first, check if POS is composable. */
- c = STRING_CHAR (cur.p, 0);
+ c = STRING_CHAR (cur.p);
if (! CHAR_COMPOSABLE_P (c))
{
if (limit < 0)
@@ -1347,7 +1347,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
fore_check_limit = cur.pos;
break;
}
- c = STRING_CHAR (cur.p, 0);
+ c = STRING_CHAR (cur.p);
if (! CHAR_COMPOSABLE_P (c))
break;
val = CHAR_TABLE_REF (Vcomposition_function_table, c);
@@ -1368,7 +1368,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
if (get_property_and_range (cur.pos, Qcomposition, &val, &b, &e, Qnil)
&& COMPOSITION_VALID_P (b, e, val))
break;
- c = STRING_CHAR (cur.p, 0);
+ c = STRING_CHAR (cur.p);
if (! CHAR_COMPOSABLE_P (c))
break;
val = CHAR_TABLE_REF (Vcomposition_function_table, c);
@@ -1391,7 +1391,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
if (NILP (check_val))
{
- c = STRING_CHAR (cur.p, 0);
+ c = STRING_CHAR (cur.p);
check_val = CHAR_TABLE_REF (Vcomposition_function_table, c);
}
for (; CONSP (check_val); check_val = XCDR (check_val))
diff --git a/src/data.c b/src/data.c
index 7110fb7eae7..ce2d842de44 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2007,8 +2007,7 @@ or a byte-code object. IDX starts at 0. */)
return make_number ((unsigned char) SREF (array, idxval));
idxval_byte = string_char_to_byte (array, idxval);
- c = STRING_CHAR (SDATA (array) + idxval_byte,
- SBYTES (array) - idxval_byte);
+ c = STRING_CHAR (SDATA (array) + idxval_byte);
return make_number (c);
}
else if (BOOL_VECTOR_P (array))
diff --git a/src/doc.c b/src/doc.c
index 30b909b8ce8..750e0ca7b43 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -767,9 +767,8 @@ a new string, without any text properties, is returned. */)
if (multibyte)
{
int len;
- int maxlen = SDATA (string) + SBYTES (string) - strp;
- STRING_CHAR_AND_LENGTH (strp, maxlen, len);
+ STRING_CHAR_AND_LENGTH (strp, len);
if (len == 1)
*bufp = *strp;
else
@@ -931,9 +930,8 @@ a new string, without any text properties, is returned. */)
else
{
int len;
- int maxlen = SDATA (string) + SBYTES (string) - strp;
- STRING_CHAR_AND_LENGTH (strp, maxlen, len);
+ STRING_CHAR_AND_LENGTH (strp, len);
if (len == 1)
*bufp = *strp;
else
diff --git a/src/editfns.c b/src/editfns.c
index 8cf182dff0f..c2c5d265cb5 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -231,7 +231,7 @@ A multibyte character is handled correctly. */)
if (SCHARS (string))
{
if (STRING_MULTIBYTE (string))
- XSETFASTINT (val, STRING_CHAR (SDATA (string), SBYTES (string)));
+ XSETFASTINT (val, STRING_CHAR (SDATA (string)));
else
XSETFASTINT (val, SREF (string, 0));
}
@@ -2983,7 +2983,7 @@ check_translation (pos, pos_byte, end, val)
memcpy (newbuf, buf, sizeof (int) * buf_used);
buf = newbuf;
}
- buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, 0, len);
+ buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, len);
pos_byte += len;
}
if (XINT (AREF (elt, i)) != buf[i])
@@ -3052,7 +3052,7 @@ It returns the number of characters changed. */)
Lisp_Object val;
if (multibyte)
- oc = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, len);
+ oc = STRING_CHAR_AND_LENGTH (p, len);
else
oc = *p, len = 1;
if (oc < size)
@@ -3064,8 +3064,7 @@ It returns the number of characters changed. */)
if (string_multibyte)
{
str = tt + string_char_to_byte (table, oc);
- nc = STRING_CHAR_AND_LENGTH (str, MAX_MULTIBYTE_LENGTH,
- str_len);
+ nc = STRING_CHAR_AND_LENGTH (str, str_len);
}
else
{
diff --git a/src/fileio.c b/src/fileio.c
index 1625c3d2547..b815c38956e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -277,7 +277,7 @@ report_file_error (string, data)
int c;
str = (char *) SDATA (errstring);
- c = STRING_CHAR (str, 0);
+ c = STRING_CHAR (str);
Faset (errstring, make_number (0), make_number (DOWNCASE (c)));
}
diff --git a/src/fns.c b/src/fns.c
index c453d05662b..8355c6c2913 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1711,8 +1711,7 @@ to be sure of changing the value of `foo'. */)
{
if (STRING_MULTIBYTE (seq))
{
- c = STRING_CHAR (SDATA (seq) + ibyte,
- SBYTES (seq) - ibyte);
+ c = STRING_CHAR (SDATA (seq) + ibyte);
cbytes = CHAR_BYTES (c);
}
else
@@ -1742,8 +1741,7 @@ to be sure of changing the value of `foo'. */)
{
if (STRING_MULTIBYTE (seq))
{
- c = STRING_CHAR (SDATA (seq) + ibyte,
- SBYTES (seq) - ibyte);
+ c = STRING_CHAR (SDATA (seq) + ibyte);
cbytes = CHAR_BYTES (c);
}
else
@@ -3363,7 +3361,7 @@ base64_encode_1 (from, to, length, line_break, multibyte)
{
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+ c = STRING_CHAR_AND_LENGTH (from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
@@ -3403,7 +3401,7 @@ base64_encode_1 (from, to, length, line_break, multibyte)
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+ c = STRING_CHAR_AND_LENGTH (from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
@@ -3427,7 +3425,7 @@ base64_encode_1 (from, to, length, line_break, multibyte)
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+ c = STRING_CHAR_AND_LENGTH (from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
diff --git a/src/font.c b/src/font.c
index 1c0a9dfb236..aa07c7805d1 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3863,7 +3863,7 @@ font_at (c, pos, face, w, string)
EMACS_INT pos_byte = string_char_to_byte (string, pos);
str = SDATA (string) + pos_byte;
- c = STRING_CHAR (str, 0);
+ c = STRING_CHAR (str);
}
else
c = SDATA (string)[pos];
diff --git a/src/indent.c b/src/indent.c
index 5a73fa1b211..c8c486a48fa 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -295,7 +295,7 @@ skip_invisible (pos, next_boundary_p, to, window)
int c; \
\
wide_column = 0; \
- c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, bytes); \
+ c = STRING_CHAR_AND_LENGTH (p, bytes); \
if (BYTES_BY_CHAR_HEAD (*p) != bytes) \
width = bytes * 4; \
else \
diff --git a/src/insdel.c b/src/insdel.c
index 0faf3c07227..0ab199ab1c7 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -648,7 +648,7 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
while (bytes_left > 0)
{
int thislen, c;
- c = STRING_CHAR_AND_LENGTH (from_addr, bytes_left, thislen);
+ c = STRING_CHAR_AND_LENGTH (from_addr, thislen);
if (! ASCII_CHAR_P (c))
c &= 0xFF;
*to_addr++ = c;
diff --git a/src/lread.c b/src/lread.c
index c565ce9fd5d..97b9410b038 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -303,7 +303,7 @@ readchar (readcharfun, multibyte)
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
BUF_INC_POS (inbuffer, pt_byte);
- c = STRING_CHAR (p, pt_byte - orig_pt_byte);
+ c = STRING_CHAR (p);
if (multibyte)
*multibyte = 1;
}
@@ -332,7 +332,7 @@ readchar (readcharfun, multibyte)
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
BUF_INC_POS (inbuffer, bytepos);
- c = STRING_CHAR (p, bytepos - orig_bytepos);
+ c = STRING_CHAR (p);
if (multibyte)
*multibyte = 1;
}
@@ -439,7 +439,7 @@ readchar (readcharfun, multibyte)
}
buf[i++] = c;
}
- return STRING_CHAR (buf, i);
+ return STRING_CHAR (buf);
}
/* Unread the character C in the way appropriate for the stream READCHARFUN.
diff --git a/src/print.c b/src/print.c
index 613660b582c..a011cb885fa 100644
--- a/src/print.c
+++ b/src/print.c
@@ -401,7 +401,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
int len;
for (i = 0; i < size_byte; i += len)
{
- int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
+ int ch = STRING_CHAR_AND_LENGTH (ptr + i, len);
insert_char (ch);
}
}
@@ -427,7 +427,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte)
corresponding character code before handing it to
PRINTCHAR. */
int len;
- int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
+ int ch = STRING_CHAR_AND_LENGTH (ptr + i, len);
PRINTCHAR (ch);
i += len;
}
@@ -519,8 +519,7 @@ print_string (string, printcharfun)
/* Here, we must convert each multi-byte form to the
corresponding character code before handing it to PRINTCHAR. */
int len;
- int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i,
- size_byte - i, len);
+ int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i, len);
PRINTCHAR (ch);
i += len;
}
@@ -1645,8 +1644,7 @@ print_object (obj, printcharfun, escapeflag)
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (str + i_byte,
- size_byte - i_byte, len);
+ c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
i_byte += len;
}
else
diff --git a/src/process.c b/src/process.c
index b604f97cffc..5c6875520e6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -477,7 +477,7 @@ status_message (p)
if (! NILP (Vlocale_coding_system))
string = (code_convert_string_norecord
(string, Vlocale_coding_system, 0));
- c1 = STRING_CHAR ((char *) SDATA (string), 0);
+ c1 = STRING_CHAR ((char *) SDATA (string));
c2 = DOWNCASE (c1);
if (c1 != c2)
Faset (string, make_number (0), make_number (c2));
diff --git a/src/regex.c b/src/regex.c
index ac7b7510a67..b3e1430fa31 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -147,10 +147,10 @@
# define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte)
# define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte)
-# define RE_STRING_CHAR(p, s, multibyte) \
- (multibyte ? (STRING_CHAR (p, s)) : (*(p)))
-# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) \
- (multibyte ? (STRING_CHAR_AND_LENGTH (p, s, len)) : ((len) = 1, *(p)))
+# define RE_STRING_CHAR(p, multibyte) \
+ (multibyte ? (STRING_CHAR (p)) : (*(p)))
+# define RE_STRING_CHAR_AND_LENGTH(p, len, multibyte) \
+ (multibyte ? (STRING_CHAR_AND_LENGTH (p, len)) : ((len) = 1, *(p)))
# define RE_CHAR_TO_MULTIBYTE(c) UNIBYTE_TO_CHAR (c)
@@ -166,7 +166,7 @@
re_char *dtemp = (p) == (str2) ? (end1) : (p); \
re_char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \
while (dtemp-- > dlimit && !CHAR_HEAD_P (*dtemp)); \
- c = STRING_CHAR (dtemp, (p) - dtemp); \
+ c = STRING_CHAR (dtemp); \
} \
else \
{ \
@@ -180,7 +180,7 @@
# define GET_CHAR_AFTER(c, p, len) \
do { \
if (target_multibyte) \
- (c) = STRING_CHAR_AND_LENGTH (p, 0, len); \
+ (c) = STRING_CHAR_AND_LENGTH (p, len); \
else \
{ \
(c) = *p; \
@@ -302,11 +302,11 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
# define SAME_CHARSET_P(c1, c2) (1)
# define MULTIBYTE_FORM_LENGTH(p, s) (1)
# define PREV_CHAR_BOUNDARY(p, limit) ((p)--)
-# define STRING_CHAR(p, s) (*(p))
-# define RE_STRING_CHAR(p, s, multibyte) STRING_CHAR ((p), (s))
+# define STRING_CHAR(p) (*(p))
+# define RE_STRING_CHAR(p, multibyte) STRING_CHAR (p)
# define CHAR_STRING(c, s) (*(s) = (c), 1)
-# define STRING_CHAR_AND_LENGTH(p, s, actual_len) ((actual_len) = 1, *(p))
-# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) STRING_CHAR_AND_LENGTH ((p), (s), (len))
+# define STRING_CHAR_AND_LENGTH(p, actual_len) ((actual_len) = 1, *(p))
+# define RE_STRING_CHAR_AND_LENGTH(p, len, multibyte) STRING_CHAR_AND_LENGTH (p, len)
# define RE_CHAR_TO_MULTIBYTE(c) (c)
# define RE_CHAR_TO_UNIBYTE(c) (c)
# define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
@@ -1757,7 +1757,7 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend,
do { \
int len; \
if (p == pend) return REG_EEND; \
- c = RE_STRING_CHAR_AND_LENGTH (p, pend - p, len, multibyte); \
+ c = RE_STRING_CHAR_AND_LENGTH (p, len, multibyte); \
p += len; \
} while (0)
@@ -4541,8 +4541,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
{
int buf_charlen;
- buf_ch = STRING_CHAR_AND_LENGTH (d, range - lim,
- buf_charlen);
+ buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
buf_ch = RE_TRANSLATE (translate, buf_ch);
if (fastmap[CHAR_LEADING_CODE (buf_ch)])
break;
@@ -4574,8 +4573,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
{
int buf_charlen;
- buf_ch = STRING_CHAR_AND_LENGTH (d, range - lim,
- buf_charlen);
+ buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
if (fastmap[CHAR_LEADING_CODE (buf_ch)])
break;
range -= buf_charlen;
@@ -4592,12 +4590,9 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
}
else /* Searching backwards. */
{
- int room = (startpos >= size1
- ? size2 + size1 - startpos
- : size1 - startpos);
if (multibyte)
{
- buf_ch = STRING_CHAR (d, room);
+ buf_ch = STRING_CHAR (d);
buf_ch = TRANSLATE (buf_ch);
if (! fastmap[CHAR_LEADING_CODE (buf_ch)])
goto advance;
@@ -4888,11 +4883,11 @@ mutually_exclusive_p (bufp, p1, p2)
{
register re_wchar_t c
= (re_opcode_t) *p2 == endline ? '\n'
- : RE_STRING_CHAR (p2 + 2, pend - p2 - 2, multibyte);
+ : RE_STRING_CHAR (p2 + 2, multibyte);
if ((re_opcode_t) *p1 == exactn)
{
- if (c != RE_STRING_CHAR (p1 + 2, pend - p1 - 2, multibyte))
+ if (c != RE_STRING_CHAR (p1 + 2, multibyte))
{
DEBUG_PRINT3 (" '%c' != '%c' => fast loop.\n", c, p1[2]);
return 1;
@@ -5543,13 +5538,13 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
PREFETCH ();
if (multibyte)
- pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen);
+ pat_ch = STRING_CHAR_AND_LENGTH (p, pat_charlen);
else
{
pat_ch = RE_CHAR_TO_MULTIBYTE (*p);
pat_charlen = 1;
}
- buf_ch = STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen);
+ buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
if (TRANSLATE (buf_ch) != pat_ch)
{
@@ -5571,7 +5566,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
PREFETCH ();
if (multibyte)
{
- pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen);
+ pat_ch = STRING_CHAR_AND_LENGTH (p, pat_charlen);
pat_ch = RE_CHAR_TO_UNIBYTE (pat_ch);
}
else
@@ -5611,7 +5606,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT1 ("EXECUTING anychar.\n");
PREFETCH ();
- buf_ch = RE_STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen,
+ buf_ch = RE_STRING_CHAR_AND_LENGTH (d, buf_charlen,
target_multibyte);
buf_ch = TRANSLATE (buf_ch);
@@ -5659,7 +5654,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
}
PREFETCH ();
- c = RE_STRING_CHAR_AND_LENGTH (d, dend - d, len, target_multibyte);
+ c = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte);
if (target_multibyte)
{
int c1;
@@ -6257,7 +6252,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
UPDATE_SYNTAX_TABLE (charpos);
#endif
PREFETCH ();
- c2 = RE_STRING_CHAR (d, dend - d, target_multibyte);
+ c2 = RE_STRING_CHAR (d, target_multibyte);
s2 = SYNTAX (c2);
/* Case 2: S2 is neither Sword nor Ssymbol. */
@@ -6310,7 +6305,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
if (!AT_STRINGS_END (d))
{
PREFETCH_NOLIMIT ();
- c2 = RE_STRING_CHAR (d, dend - d, target_multibyte);
+ c2 = RE_STRING_CHAR (d, target_multibyte);
#ifdef emacs
UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
#endif
diff --git a/src/search.c b/src/search.c
index e0546f4f998..fd45d316a46 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1387,7 +1387,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
base_pat++;
}
- c = STRING_CHAR_AND_LENGTH (base_pat, len_byte, in_charlen);
+ c = STRING_CHAR_AND_LENGTH (base_pat, in_charlen);
if (NILP (trt))
{
@@ -1527,7 +1527,6 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
EMACS_INT this_pos = pos;
EMACS_INT this_pos_byte = pos_byte;
int this_len = len;
- int this_len_byte = len_byte;
unsigned char *p = pat;
if (pos + len > lim || pos_byte + len_byte > lim_byte)
goto stop;
@@ -1537,16 +1536,14 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
int charlen, buf_charlen;
int pat_ch, buf_ch;
- pat_ch = STRING_CHAR_AND_LENGTH (p, this_len_byte, charlen);
+ pat_ch = STRING_CHAR_AND_LENGTH (p, charlen);
buf_ch = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR (this_pos_byte),
- ZV_BYTE - this_pos_byte,
buf_charlen);
TRANSLATE (buf_ch, trt, buf_ch);
if (buf_ch != pat_ch)
break;
- this_len_byte -= charlen;
this_len--;
p += charlen;
@@ -1615,7 +1612,6 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
EMACS_INT this_pos = pos - len;
EMACS_INT this_pos_byte;
int this_len = len;
- int this_len_byte = len_byte;
unsigned char *p = pat;
if (this_pos < lim || (pos_byte - len_byte) < lim_byte)
@@ -1628,16 +1624,14 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
int charlen, buf_charlen;
int pat_ch, buf_ch;
- pat_ch = STRING_CHAR_AND_LENGTH (p, this_len_byte, charlen);
+ pat_ch = STRING_CHAR_AND_LENGTH (p, charlen);
buf_ch = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR (this_pos_byte),
- ZV_BYTE - this_pos_byte,
buf_charlen);
TRANSLATE (buf_ch, trt, buf_ch);
if (buf_ch != pat_ch)
break;
- this_len_byte -= charlen;
this_len--;
p += charlen;
this_pos_byte += buf_charlen;
@@ -1841,7 +1835,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
while (! (CHAR_HEAD_P (*charstart)))
charstart--;
- ch = STRING_CHAR (charstart, ptr - charstart + 1);
+ ch = STRING_CHAR (charstart);
if (char_base != (ch & ~0x3F))
ch = -1;
}
diff --git a/src/syntax.c b/src/syntax.c
index 203792960ca..e19bfc15d1c 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -911,8 +911,7 @@ text property. */)
if (*p)
{
int len;
- int character = (STRING_CHAR_AND_LENGTH
- (p, SBYTES (string) - 1, len));
+ int character = STRING_CHAR_AND_LENGTH (p, len);
XSETINT (match, character);
if (XFASTINT (match) == ' ')
match = Qnil;
@@ -1588,12 +1587,12 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
unsigned char leading_code;
leading_code = str[i_byte];
- c = STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
+ c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
i_byte += len;
if (handle_iso_classes && c == '['
&& i_byte < size_byte
- && STRING_CHAR (str + i_byte, size_byte - i_byte) == ':')
+ && STRING_CHAR (str + i_byte) == ':')
{
const unsigned char *class_beg = str + i_byte + 1;
const unsigned char *class_end = class_beg;
@@ -1633,8 +1632,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
break;
leading_code = str[i_byte];
- c = STRING_CHAR_AND_LENGTH (str + i_byte,
- size_byte - i_byte, len);
+ c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
i_byte += len;
}
/* Treat `-' as range character only if another character
@@ -1650,15 +1648,14 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
/* Get the end of the range. */
leading_code2 = str[i_byte];
- c2 = STRING_CHAR_AND_LENGTH (str + i_byte,
- size_byte - i_byte, len);
+ c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len);
i_byte += len;
if (c2 == '\\'
&& i_byte < size_byte)
{
leading_code2 = str[i_byte];
- c2 =STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
+ c2 =STRING_CHAR_AND_LENGTH (str + i_byte, len);
i_byte += len;
}
@@ -1764,7 +1761,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
p = GAP_END_ADDR;
stop = endp;
}
- c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
+ c = STRING_CHAR_AND_LENGTH (p, nbytes);
if (! NILP (iso_classes) && in_classes (c, iso_classes))
{
if (negate)
@@ -1835,7 +1832,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
}
prev_p = p;
while (--p >= stop && ! CHAR_HEAD_P (*p));
- c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
+ c = STRING_CHAR (p);
if (! NILP (iso_classes) && in_classes (c, iso_classes))
{
@@ -1989,7 +1986,7 @@ skip_syntaxes (forwardp, string, lim)
p = GAP_END_ADDR;
stop = endp;
}
- c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
+ c = STRING_CHAR_AND_LENGTH (p, nbytes);
if (! fastmap[(int) SYNTAX (c)])
break;
p += nbytes, pos++, pos_byte += nbytes;
@@ -2032,7 +2029,7 @@ skip_syntaxes (forwardp, string, lim)
UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
prev_p = p;
while (--p >= stop && ! CHAR_HEAD_P (*p));
- c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
+ c = STRING_CHAR (p);
if (! fastmap[(int) SYNTAX (c)])
break;
pos--, pos_byte -= prev_p - p;
diff --git a/src/xdisp.c b/src/xdisp.c
index d2ae9a18fe2..9612f5cc9cf 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -919,7 +919,7 @@ static int display_echo_area P_ ((struct window *));
static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
-static int string_char_and_length P_ ((const unsigned char *, int, int *));
+static int string_char_and_length P_ ((const unsigned char *, int *));
static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
struct text_pos));
static int compute_window_start_on_continuation_line P_ ((struct window *));
@@ -1485,13 +1485,13 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
character. */
static INLINE int
-string_char_and_length (str, maxlen, len)
+string_char_and_length (str, len)
const unsigned char *str;
- int maxlen, *len;
+ int *len;
{
int c;
- c = STRING_CHAR_AND_LENGTH (str, maxlen, *len);
+ c = STRING_CHAR_AND_LENGTH (str, *len);
if (!CHAR_VALID_P (c, 1))
/* We may not change the length here because other places in Emacs
don't use this function, i.e. they silently accept invalid
@@ -1522,7 +1522,7 @@ string_pos_nchars_ahead (pos, string, nchars)
while (nchars--)
{
- string_char_and_length (p, rest, &len);
+ string_char_and_length (p, &len);
p += len, rest -= len;
xassert (rest >= 0);
CHARPOS (pos) += 1;
@@ -1574,7 +1574,7 @@ c_string_pos (charpos, s, multibyte_p)
SET_TEXT_POS (pos, 0, 0);
while (charpos--)
{
- string_char_and_length (s, rest, &len);
+ string_char_and_length (s, &len);
s += len, rest -= len;
xassert (rest >= 0);
CHARPOS (pos) += 1;
@@ -1605,7 +1605,7 @@ number_of_chars (s, multibyte_p)
for (nchars = 0; rest > 0; ++nchars)
{
- string_char_and_length (p, rest, &len);
+ string_char_and_length (p, &len);
rest -= len, p += len;
}
}
@@ -3648,7 +3648,7 @@ face_before_or_after_it_pos (it, before_p)
int c, len;
struct face *face = FACE_FROM_ID (it->f, face_id);
- c = string_char_and_length (p, rest, &len);
+ c = string_char_and_length (p, &len);
face_id = FACE_FOR_CHAR (it->f, face, c, CHARPOS (pos), it->string);
}
}
@@ -4650,7 +4650,7 @@ handle_composition_prop (it)
pos_byte = IT_STRING_BYTEPOS (*it);
string = it->string;
s = SDATA (string) + pos_byte;
- it->c = STRING_CHAR (s, 0);
+ it->c = STRING_CHAR (s);
}
else
{
@@ -6312,7 +6312,7 @@ next_element_from_string (it)
int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
const unsigned char *s = (SDATA (it->string)
+ IT_STRING_BYTEPOS (*it));
- it->c = string_char_and_length (s, remaining, &it->len);
+ it->c = string_char_and_length (s, &it->len);
}
else
{
@@ -6348,7 +6348,7 @@ next_element_from_string (it)
int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
const unsigned char *s = (SDATA (it->string)
+ IT_STRING_BYTEPOS (*it));
- it->c = string_char_and_length (s, maxlen, &it->len);
+ it->c = string_char_and_length (s, &it->len);
}
else
{
@@ -6404,8 +6404,7 @@ next_element_from_c_string (it)
performance problem because there is no noticeable performance
difference between Emacs running in unibyte or multibyte mode. */
int maxlen = strlen (it->s) - IT_BYTEPOS (*it);
- it->c = string_char_and_length (it->s + IT_BYTEPOS (*it),
- maxlen, &it->len);
+ it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
}
else
it->c = it->s[IT_BYTEPOS (*it)], it->len = 1;
@@ -6535,7 +6534,7 @@ next_element_from_buffer (it)
/* Get the next character, maybe multibyte. */
p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
if (it->multibyte_p && !ASCII_BYTE_P (*p))
- it->c = STRING_CHAR_AND_LENGTH (p, 0, it->len);
+ it->c = STRING_CHAR_AND_LENGTH (p, it->len);
else
it->c = *p, it->len = 1;
@@ -7756,7 +7755,7 @@ message_dolog (m, nbytes, nlflag, multibyte)
for the *Message* buffer. */
for (i = 0; i < nbytes; i += char_bytes)
{
- c = string_char_and_length (m + i, nbytes - i, &char_bytes);
+ c = string_char_and_length (m + i, &char_bytes);
work[0] = (ASCII_CHAR_P (c)
? c
: multibyte_char_to_unibyte (c, Qnil));
@@ -9061,7 +9060,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
/* Convert a multibyte string to single-byte. */
for (i = 0; i < nbytes; i += n)
{
- c = string_char_and_length (s + i, nbytes - i, &n);
+ c = string_char_and_length (s + i, &n);
work[0] = (ASCII_CHAR_P (c)
? c
: multibyte_char_to_unibyte (c, Qnil));
@@ -15903,7 +15902,7 @@ get_overlay_arrow_glyph_row (w, overlay_arrow_string)
/* Get the next character. */
if (multibyte_p)
- it.c = string_char_and_length (p, arrow_len, &it.len);
+ it.c = string_char_and_length (p, &it.len);
else
it.c = *p, it.len = 1;
p += it.len;
@@ -20930,7 +20929,7 @@ produce_stretch_glyph (it)
{
int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT)
- IT_BYTEPOS (*it));
- it2.c = STRING_CHAR_AND_LENGTH (p, maxlen, it2.len);
+ it2.c = STRING_CHAR_AND_LENGTH (p, it2.len);
}
else
it2.c = *p, it2.len = 1;
diff --git a/src/xterm.c b/src/xterm.c
index c4cf3de12fc..f18b8105c02 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6578,8 +6578,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
if (nchars == nbytes)
c = copy_bufptr[i], len = 1;
else
- c = STRING_CHAR_AND_LENGTH (copy_bufptr + i,
- nbytes - i, len);
+ c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len);
inev.ie.kind = (SINGLE_BYTE_CHAR_P (c)
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);