aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn2002-07-16 19:49:12 +0000
committerKen Raeburn2002-07-16 19:49:12 +0000
commit50f80c2fbcdf1533ca88873ba3a807b487fb07ab (patch)
treefbc1b771ac1d69e0045ea30f34b2c847e8af49fa /src
parentc8863dae8411bd9e4e4ec5144104a3b742955ec2 (diff)
downloademacs-50f80c2fbcdf1533ca88873ba3a807b487fb07ab.tar.gz
emacs-50f80c2fbcdf1533ca88873ba3a807b487fb07ab.zip
(store_frame_title, string_char_and_length):
(message_dolog, message2, message2_nolog, set_message): String pointer args now point to const. (set_message_1): Cast message string argument to const pointer. (string_pos_nchars_ahead, init_from_display_pos): (face_before_or_after_it_pos, next_element_from_string): (get_overlay_arrow_glyph_row, display_mode_element): (decode_mode_spec_coding): Use const for pointer to lisp string data.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 6afed354b07..75189408d13 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -713,7 +713,7 @@ static struct text_pos run_window_scroll_functions P_ ((Lisp_Object,
713static void reconsider_clip_changes P_ ((struct window *, struct buffer *)); 713static void reconsider_clip_changes P_ ((struct window *, struct buffer *));
714static int text_outside_line_unchanged_p P_ ((struct window *, int, int)); 714static int text_outside_line_unchanged_p P_ ((struct window *, int, int));
715static void store_frame_title_char P_ ((char)); 715static void store_frame_title_char P_ ((char));
716static int store_frame_title P_ ((unsigned char *, int, int)); 716static int store_frame_title P_ ((const unsigned char *, int, int));
717static void x_consider_frame_title P_ ((Lisp_Object)); 717static void x_consider_frame_title P_ ((Lisp_Object));
718static void handle_stop P_ ((struct it *)); 718static void handle_stop P_ ((struct it *));
719static int tool_bar_lines_needed P_ ((struct frame *)); 719static int tool_bar_lines_needed P_ ((struct frame *));
@@ -732,7 +732,7 @@ static int display_echo_area P_ ((struct window *));
732static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); 732static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
733static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); 733static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
734static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); 734static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
735static int string_char_and_length P_ ((unsigned char *, int, int *)); 735static int string_char_and_length P_ ((const unsigned char *, int, int *));
736static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, 736static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
737 struct text_pos)); 737 struct text_pos));
738static int compute_window_start_on_continuation_line P_ ((struct window *)); 738static int compute_window_start_on_continuation_line P_ ((struct window *));
@@ -1149,7 +1149,7 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p)
1149 1149
1150static INLINE int 1150static INLINE int
1151string_char_and_length (str, maxlen, len) 1151string_char_and_length (str, maxlen, len)
1152 unsigned char *str; 1152 const unsigned char *str;
1153 int maxlen, *len; 1153 int maxlen, *len;
1154{ 1154{
1155 int c; 1155 int c;
@@ -1180,7 +1180,7 @@ string_pos_nchars_ahead (pos, string, nchars)
1180 if (STRING_MULTIBYTE (string)) 1180 if (STRING_MULTIBYTE (string))
1181 { 1181 {
1182 int rest = SBYTES (string) - BYTEPOS (pos); 1182 int rest = SBYTES (string) - BYTEPOS (pos);
1183 unsigned char *p = SDATA (string) + BYTEPOS (pos); 1183 const unsigned char *p = SDATA (string) + BYTEPOS (pos);
1184 int len; 1184 int len;
1185 1185
1186 while (nchars--) 1186 while (nchars--)
@@ -1878,8 +1878,8 @@ init_from_display_pos (it, w, pos)
1878 1878
1879 for (i = 0; i < it->n_overlay_strings; ++i) 1879 for (i = 0; i < it->n_overlay_strings; ++i)
1880 { 1880 {
1881 char *s = SDATA (it->overlay_strings[i]); 1881 const char *s = SDATA (it->overlay_strings[i]);
1882 char *e = s + SBYTES (it->overlay_strings[i]); 1882 const char *e = s + SBYTES (it->overlay_strings[i]);
1883 1883
1884 while (s < e && *s != '\n') 1884 while (s < e && *s != '\n')
1885 ++s; 1885 ++s;
@@ -2485,7 +2485,7 @@ face_before_or_after_it_pos (it, before_p)
2485 suitable for unibyte text if IT->string is unibyte. */ 2485 suitable for unibyte text if IT->string is unibyte. */
2486 if (STRING_MULTIBYTE (it->string)) 2486 if (STRING_MULTIBYTE (it->string))
2487 { 2487 {
2488 unsigned char *p = SDATA (it->string) + BYTEPOS (pos); 2488 const unsigned char *p = SDATA (it->string) + BYTEPOS (pos);
2489 int rest = SBYTES (it->string) - BYTEPOS (pos); 2489 int rest = SBYTES (it->string) - BYTEPOS (pos);
2490 int c, len; 2490 int c, len;
2491 struct face *face = FACE_FROM_ID (it->f, face_id); 2491 struct face *face = FACE_FROM_ID (it->f, face_id);
@@ -4612,7 +4612,8 @@ next_element_from_string (it)
4612 else if (STRING_MULTIBYTE (it->string)) 4612 else if (STRING_MULTIBYTE (it->string))
4613 { 4613 {
4614 int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); 4614 int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
4615 unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it); 4615 const unsigned char *s = (SDATA (it->string)
4616 + IT_STRING_BYTEPOS (*it));
4616 it->c = string_char_and_length (s, remaining, &it->len); 4617 it->c = string_char_and_length (s, remaining, &it->len);
4617 } 4618 }
4618 else 4619 else
@@ -4641,7 +4642,8 @@ next_element_from_string (it)
4641 else if (STRING_MULTIBYTE (it->string)) 4642 else if (STRING_MULTIBYTE (it->string))
4642 { 4643 {
4643 int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); 4644 int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
4644 unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it); 4645 const unsigned char *s = (SDATA (it->string)
4646 + IT_STRING_BYTEPOS (*it));
4645 it->c = string_char_and_length (s, maxlen, &it->len); 4647 it->c = string_char_and_length (s, maxlen, &it->len);
4646 } 4648 }
4647 else 4649 else
@@ -5653,7 +5655,7 @@ message_log_maybe_newline ()
5653 5655
5654void 5656void
5655message_dolog (m, nbytes, nlflag, multibyte) 5657message_dolog (m, nbytes, nlflag, multibyte)
5656 char *m; 5658 const char *m;
5657 int nbytes, nlflag, multibyte; 5659 int nbytes, nlflag, multibyte;
5658{ 5660{
5659 if (!NILP (Vmemory_full)) 5661 if (!NILP (Vmemory_full))
@@ -5867,7 +5869,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte)
5867 5869
5868void 5870void
5869message2 (m, nbytes, multibyte) 5871message2 (m, nbytes, multibyte)
5870 char *m; 5872 const char *m;
5871 int nbytes; 5873 int nbytes;
5872 int multibyte; 5874 int multibyte;
5873{ 5875{
@@ -5883,7 +5885,7 @@ message2 (m, nbytes, multibyte)
5883 5885
5884void 5886void
5885message2_nolog (m, nbytes, multibyte) 5887message2_nolog (m, nbytes, multibyte)
5886 char *m; 5888 const char *m;
5887 int nbytes; 5889 int nbytes;
5888{ 5890{
5889 struct frame *sf = SELECTED_FRAME (); 5891 struct frame *sf = SELECTED_FRAME ();
@@ -6904,7 +6906,7 @@ truncate_message_1 (nchars, a2, a3, a4)
6904 6906
6905void 6907void
6906set_message (s, string, nbytes, multibyte_p) 6908set_message (s, string, nbytes, multibyte_p)
6907 char *s; 6909 const char *s;
6908 Lisp_Object string; 6910 Lisp_Object string;
6909 int nbytes; 6911 int nbytes;
6910{ 6912{
@@ -6930,7 +6932,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
6930 Lisp_Object a2; 6932 Lisp_Object a2;
6931 EMACS_INT nbytes, multibyte_p; 6933 EMACS_INT nbytes, multibyte_p;
6932{ 6934{
6933 char *s = (char *) a1; 6935 const char *s = (const char *) a1;
6934 Lisp_Object string = a2; 6936 Lisp_Object string = a2;
6935 6937
6936 xassert (BEG == Z); 6938 xassert (BEG == Z);
@@ -6984,7 +6986,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
6984 { 6986 {
6985 /* Convert from single-byte to multi-byte. */ 6987 /* Convert from single-byte to multi-byte. */
6986 int i, c, n; 6988 int i, c, n;
6987 unsigned char *msg = (unsigned char *) s; 6989 const unsigned char *msg = (const unsigned char *) s;
6988 unsigned char str[MAX_MULTIBYTE_LENGTH]; 6990 unsigned char str[MAX_MULTIBYTE_LENGTH];
6989 6991
6990 /* Convert a single-byte string to multibyte. */ 6992 /* Convert a single-byte string to multibyte. */
@@ -7222,7 +7224,7 @@ store_frame_title_char (c)
7222 7224
7223static int 7225static int
7224store_frame_title (str, field_width, precision) 7226store_frame_title (str, field_width, precision)
7225 unsigned char *str; 7227 const unsigned char *str;
7226 int field_width, precision; 7228 int field_width, precision;
7227{ 7229{
7228 int n = 0; 7230 int n = 0;
@@ -12510,10 +12512,10 @@ get_overlay_arrow_glyph_row (w)
12510 struct frame *f = XFRAME (WINDOW_FRAME (w)); 12512 struct frame *f = XFRAME (WINDOW_FRAME (w));
12511 struct buffer *buffer = XBUFFER (w->buffer); 12513 struct buffer *buffer = XBUFFER (w->buffer);
12512 struct buffer *old = current_buffer; 12514 struct buffer *old = current_buffer;
12513 unsigned char *arrow_string = SDATA (Voverlay_arrow_string); 12515 const unsigned char *arrow_string = SDATA (Voverlay_arrow_string);
12514 int arrow_len = SCHARS (Voverlay_arrow_string); 12516 int arrow_len = SCHARS (Voverlay_arrow_string);
12515 unsigned char *arrow_end = arrow_string + arrow_len; 12517 const unsigned char *arrow_end = arrow_string + arrow_len;
12516 unsigned char *p; 12518 const unsigned char *p;
12517 struct it it; 12519 struct it it;
12518 int multibyte_p; 12520 int multibyte_p;
12519 int n_glyphs_before; 12521 int n_glyphs_before;
@@ -13717,7 +13719,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
13717 { 13719 {
13718 /* A string: output it and check for %-constructs within it. */ 13720 /* A string: output it and check for %-constructs within it. */
13719 unsigned char c; 13721 unsigned char c;
13720 unsigned char *this, *lisp_string; 13722 const unsigned char *this, *lisp_string;
13721 13723
13722 if (!NILP (props) || risky) 13724 if (!NILP (props) || risky)
13723 { 13725 {
@@ -13794,7 +13796,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
13794 || !NILP (mode_line_string_list) 13796 || !NILP (mode_line_string_list)
13795 || it->current_x < it->last_visible_x)) 13797 || it->current_x < it->last_visible_x))
13796 { 13798 {
13797 unsigned char *last = this; 13799 const unsigned char *last = this;
13798 13800
13799 /* Advance to end of string or next format specifier. */ 13801 /* Advance to end of string or next format specifier. */
13800 while ((c = *this++) != '\0' && c != '%') 13802 while ((c = *this++) != '\0' && c != '%')
@@ -13833,7 +13835,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
13833 } 13835 }
13834 else /* c == '%' */ 13836 else /* c == '%' */
13835 { 13837 {
13836 unsigned char *percent_position = this; 13838 const unsigned char *percent_position = this;
13837 13839
13838 /* Get the specified minimum width. Zero means 13840 /* Get the specified minimum width. Zero means
13839 don't pad. */ 13841 don't pad. */
@@ -14333,7 +14335,7 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
14333{ 14335{
14334 Lisp_Object val; 14336 Lisp_Object val;
14335 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 14337 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
14336 unsigned char *eol_str; 14338 const unsigned char *eol_str;
14337 int eol_str_len; 14339 int eol_str_len;
14338 /* The EOL conversion we are using. */ 14340 /* The EOL conversion we are using. */
14339 Lisp_Object eoltype; 14341 Lisp_Object eoltype;
@@ -14385,8 +14387,9 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
14385 else if (INTEGERP (eoltype) 14387 else if (INTEGERP (eoltype)
14386 && CHAR_VALID_P (XINT (eoltype), 0)) 14388 && CHAR_VALID_P (XINT (eoltype), 0))
14387 { 14389 {
14388 eol_str = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH); 14390 unsigned char *tmp = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH);
14389 eol_str_len = CHAR_STRING (XINT (eoltype), eol_str); 14391 eol_str_len = CHAR_STRING (XINT (eoltype), tmp);
14392 eol_str = tmp;
14390 } 14393 }
14391 else 14394 else
14392 { 14395 {