Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
b68864e5
Commit
b68864e5
authored
Feb 06, 2011
by
Paul Eggert
Browse files
* insdel.c: conform to C89 pointer rules
parent
f8b351c1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
42 deletions
+46
-42
src/ChangeLog
src/ChangeLog
+7
-0
src/buffer.c
src/buffer.c
+1
-1
src/cmds.c
src/cmds.c
+3
-4
src/coding.c
src/coding.c
+1
-1
src/editfns.c
src/editfns.c
+5
-5
src/fileio.c
src/fileio.c
+1
-1
src/insdel.c
src/insdel.c
+13
-14
src/lisp.h
src/lisp.h
+6
-7
src/print.c
src/print.c
+1
-1
src/xdisp.c
src/xdisp.c
+8
-8
No files found.
src/ChangeLog
View file @
b68864e5
...
...
@@ -17,6 +17,13 @@
* image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise.
* keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input):
Likewise.
* insdel.c (insert, insert_and_inherit, insert_before_markers):
(insert_before_markers_and_inherit, insert_1, insert_1_both):
Likewise. This changes these functions' signatures, which is
more convenient since most callers use char *. All remaining
callers changed.
* editfns.c (general_insert_function): Change signature to
match changes to insert functions' signatures.
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
src/buffer.c
View file @
b68864e5
...
...
@@ -2401,7 +2401,7 @@ current buffer is cleared. */)
*p = tmp[0];
TEMP_SET_PT_BOTH (pos + 1, pos + 1);
bytes--;
insert_1_both (tmp + 1, bytes, bytes, 1, 0, 0);
insert_1_both (
(char *)
tmp + 1, bytes, bytes, 1, 0, 0);
/* Now the gap is after the just inserted data. */
pos = GPT;
p = GAP_END_ADDR;
...
...
src/cmds.c
View file @
b68864e5
...
...
@@ -466,15 +466,15 @@ internal_self_insert (int c, EMACS_INT n)
else
if
(
n
>
1
)
{
USE_SAFE_ALLOCA
;
unsigned
char
*
strn
,
*
p
;
SAFE_ALLOCA
(
strn
,
unsigned
char
*
,
n
*
len
);
char
*
strn
,
*
p
;
SAFE_ALLOCA
(
strn
,
char
*
,
n
*
len
);
for
(
p
=
strn
;
n
>
0
;
n
--
,
p
+=
len
)
memcpy
(
p
,
str
,
len
);
insert_and_inherit
(
strn
,
p
-
strn
);
SAFE_FREE
();
}
else
if
(
n
>
0
)
insert_and_inherit
(
str
,
len
);
insert_and_inherit
(
(
char
*
)
str
,
len
);
if
((
CHAR_TABLE_P
(
Vauto_fill_chars
)
?
!
NILP
(
CHAR_TABLE_REF
(
Vauto_fill_chars
,
c
))
...
...
@@ -559,4 +559,3 @@ keys_of_cmds (void)
initial_define_key
(
global_map
,
Ctl
(
'E'
),
"end-of-line"
);
initial_define_key
(
global_map
,
Ctl
(
'F'
),
"forward-char"
);
}
src/coding.c
View file @
b68864e5
...
...
@@ -7880,7 +7880,7 @@ encode_coding_object (struct coding_system *coding,
else if (BUFFERP (src_object))
insert_from_buffer (XBUFFER (src_object), from, chars, 0);
else
insert_1_both (coding->source + from, chars, bytes, 0, 0, 0);
insert_1_both (
(char *)
coding->source + from, chars, bytes, 0, 0, 0);
if (EQ (src_object, dst_object))
{
...
...
src/editfns.c
View file @
b68864e5
...
...
@@ -94,7 +94,7 @@ static void update_buffer_properties (EMACS_INT, EMACS_INT);
static Lisp_Object region_limit (int);
static size_t emacs_nmemftime (char *, size_t, const char *,
size_t, const struct tm *, int, int);
static void general_insert_function (void (*) (const
unsigned
char *, EMACS_INT),
static void general_insert_function (void (*) (const char *, EMACS_INT),
void (*) (Lisp_Object, EMACS_INT,
EMACS_INT, EMACS_INT,
EMACS_INT, int),
...
...
@@ -2118,7 +2118,7 @@ set_time_zone_rule (const char *tzstring)
static void
general_insert_function (void (*insert_func)
(const
unsigned
char *, EMACS_INT),
(const char *, EMACS_INT),
void (*insert_from_string_func)
(Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, int),
...
...
@@ -2144,7 +2144,7 @@ general_insert_function (void (*insert_func)
: multibyte_char_to_unibyte (XINT (val), Qnil));
len = 1;
}
(*insert_func) (str, len);
(*insert_func) (
(char *)
str, len);
}
else if (STRINGP (val))
{
...
...
@@ -2257,7 +2257,7 @@ The optional third arg INHERIT, if non-nil, says to inherit text properties
from adjoining text, if those properties are sticky. */)
(Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
{
register
unsigned
char *string;
register char *string;
register EMACS_INT strlen;
register int i;
register EMACS_INT n;
...
...
@@ -2277,7 +2277,7 @@ from adjoining text, if those properties are sticky. */)
if (n <= 0)
return Qnil;
strlen = min (n, 256 * len);
string = (
unsigned
char *) alloca (strlen);
string = (char *) alloca (strlen);
for (i = 0; i < strlen; i++)
string[i] = str[i % len];
while (n >= strlen)
...
...
src/fileio.c
View file @
b68864e5
...
...
@@ -3412,7 +3412,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
Ferase_buffer ();
buf->enable_multibyte_characters = Qnil;
insert_1_both (read_buf, nread, nread, 0, 0, 0);
insert_1_both (
(char *)
read_buf, nread, nread, 0, 0, 0);
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
coding_system = call2 (Vset_auto_coding_function,
filename, make_number (nread));
...
...
src/insdel.c
View file @
b68864e5
...
...
@@ -668,11 +668,11 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
prepare_to_modify_buffer could relocate the text. */
void
insert
(
const
unsigned
char
*
string
,
EMACS_INT
nbytes
)
insert
(
const
char
*
string
,
EMACS_INT
nbytes
)
{
if
(
nbytes
>
0
)
{
EMACS_INT
len
=
chars_in_text
(
string
,
nbytes
),
opoint
;
EMACS_INT
len
=
chars_in_text
(
(
unsigned
char
*
)
string
,
nbytes
),
opoint
;
insert_1_both
(
string
,
len
,
nbytes
,
0
,
1
,
0
);
opoint
=
PT
-
len
;
signal_after_change
(
opoint
,
0
,
len
);
...
...
@@ -683,11 +683,11 @@ insert (const unsigned char *string, EMACS_INT nbytes)
/* Likewise, but inherit text properties from neighboring characters. */
void
insert_and_inherit
(
const
unsigned
char
*
string
,
EMACS_INT
nbytes
)
insert_and_inherit
(
const
char
*
string
,
EMACS_INT
nbytes
)
{
if
(
nbytes
>
0
)
{
EMACS_INT
len
=
chars_in_text
(
string
,
nbytes
),
opoint
;
EMACS_INT
len
=
chars_in_text
(
(
unsigned
char
*
)
string
,
nbytes
),
opoint
;
insert_1_both
(
string
,
len
,
nbytes
,
1
,
1
,
0
);
opoint
=
PT
-
len
;
signal_after_change
(
opoint
,
0
,
len
);
...
...
@@ -711,7 +711,7 @@ insert_char (int c)
str
[
0
]
=
c
;
}
insert
(
str
,
len
);
insert
(
(
char
*
)
str
,
len
);
}
/* Insert the null-terminated string S before point. */
...
...
@@ -728,11 +728,11 @@ insert_string (const char *s)
since gc could happen and relocate it. */
void
insert_before_markers
(
const
unsigned
char
*
string
,
EMACS_INT
nbytes
)
insert_before_markers
(
const
char
*
string
,
EMACS_INT
nbytes
)
{
if
(
nbytes
>
0
)
{
EMACS_INT
len
=
chars_in_text
(
string
,
nbytes
),
opoint
;
EMACS_INT
len
=
chars_in_text
(
(
unsigned
char
*
)
string
,
nbytes
),
opoint
;
insert_1_both
(
string
,
len
,
nbytes
,
0
,
1
,
1
);
opoint
=
PT
-
len
;
signal_after_change
(
opoint
,
0
,
len
);
...
...
@@ -743,12 +743,12 @@ insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
/* Likewise, but inherit text properties from neighboring characters. */
void
insert_before_markers_and_inherit
(
const
unsigned
char
*
string
,
insert_before_markers_and_inherit
(
const
char
*
string
,
EMACS_INT
nbytes
)
{
if
(
nbytes
>
0
)
{
EMACS_INT
len
=
chars_in_text
(
string
,
nbytes
),
opoint
;
EMACS_INT
len
=
chars_in_text
(
(
unsigned
char
*
)
string
,
nbytes
),
opoint
;
insert_1_both
(
string
,
len
,
nbytes
,
1
,
1
,
1
);
opoint
=
PT
-
len
;
signal_after_change
(
opoint
,
0
,
len
);
...
...
@@ -759,11 +759,11 @@ insert_before_markers_and_inherit (const unsigned char *string,
/* Subroutine used by the insert functions above. */
void
insert_1
(
const
unsigned
char
*
string
,
EMACS_INT
nbytes
,
insert_1
(
const
char
*
string
,
EMACS_INT
nbytes
,
int
inherit
,
int
prepare
,
int
before_markers
)
{
insert_1_both
(
string
,
chars_in_text
(
string
,
nbytes
),
nbytes
,
inherit
,
prepare
,
before_markers
);
insert_1_both
(
string
,
chars_in_text
(
(
unsigned
char
*
)
string
,
nbytes
),
nbytes
,
inherit
,
prepare
,
before_markers
);
}
...
...
@@ -884,7 +884,7 @@ count_combining_after (const unsigned char *string,
are the same as in insert_1. */
void
insert_1_both
(
const
unsigned
char
*
string
,
insert_1_both
(
const
char
*
string
,
EMACS_INT
nchars
,
EMACS_INT
nbytes
,
int
inherit
,
int
prepare
,
int
before_markers
)
{
...
...
@@ -2382,4 +2382,3 @@ as well as hooks attached to text properties and overlays. */);
defsubr
(
&
Scombine_after_change_execute
);
}
src/lisp.h
View file @
b68864e5
...
...
@@ -2555,10 +2555,10 @@ extern int count_combining_before (const unsigned char *,
EMACS_INT
,
EMACS_INT
,
EMACS_INT
);
extern
int
count_combining_after
(
const
unsigned
char
*
,
EMACS_INT
,
EMACS_INT
,
EMACS_INT
);
extern
void
insert
(
const
unsigned
char
*
,
EMACS_INT
);
extern
void
insert_and_inherit
(
const
unsigned
char
*
,
EMACS_INT
);
extern
void
insert_1
(
const
unsigned
char
*
,
EMACS_INT
,
int
,
int
,
int
);
extern
void
insert_1_both
(
const
unsigned
char
*
,
EMACS_INT
,
EMACS_INT
,
extern
void
insert
(
const
char
*
,
EMACS_INT
);
extern
void
insert_and_inherit
(
const
char
*
,
EMACS_INT
);
extern
void
insert_1
(
const
char
*
,
EMACS_INT
,
int
,
int
,
int
);
extern
void
insert_1_both
(
const
char
*
,
EMACS_INT
,
EMACS_INT
,
int
,
int
,
int
);
extern
void
insert_from_gap
(
EMACS_INT
,
EMACS_INT
);
extern
void
insert_from_string
(
Lisp_Object
,
EMACS_INT
,
EMACS_INT
,
...
...
@@ -2566,9 +2566,8 @@ extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
extern
void
insert_from_buffer
(
struct
buffer
*
,
EMACS_INT
,
EMACS_INT
,
int
);
extern
void
insert_char
(
int
);
extern
void
insert_string
(
const
char
*
);
extern
void
insert_before_markers
(
const
unsigned
char
*
,
EMACS_INT
);
extern
void
insert_before_markers_and_inherit
(
const
unsigned
char
*
,
EMACS_INT
);
extern
void
insert_before_markers
(
const
char
*
,
EMACS_INT
);
extern
void
insert_before_markers_and_inherit
(
const
char
*
,
EMACS_INT
);
extern
void
insert_from_string_before_markers
(
Lisp_Object
,
EMACS_INT
,
EMACS_INT
,
EMACS_INT
,
EMACS_INT
,
int
);
...
...
src/print.c
View file @
b68864e5
...
...
@@ -179,7 +179,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
= (unsigned char *) alloca (print_buffer_pos + 1); \
copy_text (print_buffer, temp, print_buffer_pos_byte, \
1, 0); \
insert_1_both (temp, print_buffer_pos,
\
insert_1_both (
(char *)
temp, print_buffer_pos, \
print_buffer_pos, 0, 1, 0); \
} \
else \
...
...
src/xdisp.c
View file @
b68864e5
...
...
@@ -7930,7 +7930,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
{
EMACS_INT i;
int c, char_bytes;
unsigned
char work[1];
char work[1];
/* Convert a multibyte string to single-byte
for the *Message* buffer. */
...
...
@@ -7956,17 +7956,17 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
c = msg[i];
MAKE_CHAR_MULTIBYTE (c);
char_bytes = CHAR_STRING (c, str);
insert_1_both (str, 1, char_bytes, 1, 0, 0);
insert_1_both (
(char *)
str, 1, char_bytes, 1, 0, 0);
}
}
else if (nbytes)
insert_1 (m
sg
, nbytes, 1, 0, 0);
insert_1 (m, nbytes, 1, 0, 0);
if (nlflag)
{
EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
int dup;
insert_1 (
(const unsigned char *)
"\n", 1, 1, 0, 0);
insert_1 ("\n", 1, 1, 0, 0);
scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
this_bol = PT;
...
...
@@ -7996,7 +7996,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
sprintf (dupstr, " [%d times]", dup);
duplen = strlen (dupstr);
TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
insert_1 (
(unsigned char *)
dupstr, duplen, 1, 0, 1);
insert_1 (dupstr, duplen, 1, 0, 1);
}
}
}
...
...
@@ -9193,7 +9193,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
/* Convert from multi-byte to single-byte. */
EMACS_INT i;
int c, n;
unsigned
char work[1];
char work[1];
/* Convert a multibyte string to single-byte. */
for (i = 0; i < nbytes; i += n)
...
...
@@ -9219,11 +9219,11 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
c = msg[i];
MAKE_CHAR_MULTIBYTE (c);
n = CHAR_STRING (c, str);
insert_1_both (str, 1, n, 1, 0, 0);
insert_1_both (
(char *)
str, 1, n, 1, 0, 0);
}
}
else
insert_1 (
msg
, nbytes, 1, 0, 0);
insert_1 (
s
, nbytes, 1, 0, 0);
}
return 0;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment