diff options
author | Paul Eggert <[email protected]> | 2011-05-20 21:33:23 -0700 |
---|---|---|
committer | Paul Eggert <[email protected]> | 2011-05-20 21:33:23 -0700 |
commit | de883a701d8f0db9595c6c459fdff9e3bb20bc83 (patch) | |
tree | aba160bb28d92c3fbec56549e211bd1f705b273e /src/insdel.c | |
parent | 1dcf791fefa6533a06f58a5d2d074f59f06ee9ae (diff) |
merge count_size_as_multibyte, parse_str_to_multibyte
* character.c, character.h (count_size_as_multibyte):
Renamed from parse_str_to_multibyte; all uses changed.
Check for integer overflow.
* insdel.c, lisp.h (count_size_as_multibyte): Remove,
since it's now a duplicate of the other. This is more of
a character than a buffer op, so better that it's in character.c.
* fns.c, print.c: Adjust to above changes.
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/insdel.c b/src/insdel.c index de9e8aa570..c0cccc65d6 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -570,37 +570,6 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, return to_addr - initial_to_addr; } } - -/* Return the number of bytes it would take - to convert some single-byte text to multibyte. - The single-byte text consists of NBYTES bytes at PTR. */ - -EMACS_INT -count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes) -{ - EMACS_INT i; - EMACS_INT outgoing_nbytes = 0; - - for (i = 0; i < nbytes; i++) - { - unsigned int c = *ptr++; - int n; - - if (ASCII_CHAR_P (c)) - n = 1; - else - { - c = BYTE8_TO_CHAR (c); - n = CHAR_BYTES (c); - } - - if (INT_ADD_OVERFLOW (outgoing_nbytes, n)) - string_overflow (); - outgoing_nbytes += n; - } - - return outgoing_nbytes; -} /* Insert a string of specified length before point. This function judges multibyteness based on |