Mercurial > emacs
changeset 71827:5e4428007299
(casify_object): Remove loop around wrong_type_argument.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 12 Jul 2006 13:14:51 +0000 |
parents | e80165512dee |
children | 10b94d33e0d8 |
files | src/casefiddle.c |
diffstat | 1 files changed, 53 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/src/casefiddle.c Wed Jul 12 13:14:38 2006 +0000 +++ b/src/casefiddle.c Wed Jul 12 13:14:51 2006 +0000 @@ -45,75 +45,73 @@ if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) Fset_case_table (current_buffer->downcase_table); - while (1) + if (INTEGERP (obj)) { - if (INTEGERP (obj)) - { - int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER - | CHAR_SHIFT | CHAR_CTL | CHAR_META); - int flags = XINT (obj) & flagbits; + int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER + | CHAR_SHIFT | CHAR_CTL | CHAR_META); + int flags = XINT (obj) & flagbits; - /* If the character has higher bits set - above the flags, return it unchanged. - It is not a real character. */ - if ((unsigned) XFASTINT (obj) > (unsigned) flagbits) - return obj; + /* If the character has higher bits set + above the flags, return it unchanged. + It is not a real character. */ + if ((unsigned) XFASTINT (obj) > (unsigned) flagbits) + return obj; - c = DOWNCASE (XFASTINT (obj) & ~flagbits); - if (inword) - XSETFASTINT (obj, c | flags); - else if (c == (XFASTINT (obj) & ~flagbits)) - { - c = UPCASE1 ((XFASTINT (obj) & ~flagbits)); - XSETFASTINT (obj, c | flags); - } - return obj; + c = DOWNCASE (XFASTINT (obj) & ~flagbits); + if (inword) + XSETFASTINT (obj, c | flags); + else if (c == (XFASTINT (obj) & ~flagbits)) + { + c = UPCASE1 ((XFASTINT (obj) & ~flagbits)); + XSETFASTINT (obj, c | flags); } + return obj; + } - if (STRINGP (obj)) - { - int multibyte = STRING_MULTIBYTE (obj); - int n; + if (STRINGP (obj)) + { + int multibyte = STRING_MULTIBYTE (obj); + int n; - obj = Fcopy_sequence (obj); - len = SBYTES (obj); + obj = Fcopy_sequence (obj); + len = SBYTES (obj); - /* I counts bytes, and N counts chars. */ - for (i = n = 0; i < len; n++) - { - int from_len = 1, to_len = 1; + /* I counts bytes, and N counts chars. */ + for (i = n = 0; i < len; n++) + { + int from_len = 1, to_len = 1; + + c = SREF (obj, i); - c = SREF (obj, i); - - if (multibyte && c >= 0x80) - c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len); - if (inword && flag != CASE_CAPITALIZE_UP) - c = DOWNCASE (c); - else if (!UPPERCASEP (c) - && (!inword || flag != CASE_CAPITALIZE_UP)) - c = UPCASE1 (c); - if ((ASCII_BYTE_P (c) && from_len == 1) - || (! multibyte && SINGLE_BYTE_CHAR_P (c))) - SSET (obj, i, c); + if (multibyte && c >= 0x80) + c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len); + if (inword && flag != CASE_CAPITALIZE_UP) + c = DOWNCASE (c); + else if (!UPPERCASEP (c) + && (!inword || flag != CASE_CAPITALIZE_UP)) + c = UPCASE1 (c); + if ((ASCII_BYTE_P (c) && from_len == 1) + || (! multibyte && SINGLE_BYTE_CHAR_P (c))) + SSET (obj, i, c); + else + { + to_len = CHAR_BYTES (c); + if (from_len == to_len) + CHAR_STRING (c, SDATA (obj) + i); else { - to_len = CHAR_BYTES (c); - if (from_len == to_len) - CHAR_STRING (c, SDATA (obj) + i); - else - { - Faset (obj, make_number (n), make_number (c)); - len += to_len - from_len; - } + Faset (obj, make_number (n), make_number (c)); + len += to_len - from_len; } - if ((int) flag >= (int) CASE_CAPITALIZE) - inword = SYNTAX (c) == Sword; - i += to_len; } - return obj; + if ((int) flag >= (int) CASE_CAPITALIZE) + inword = SYNTAX (c) == Sword; + i += to_len; } - obj = wrong_type_argument (Qchar_or_string_p, obj); + return obj; } + + return wrong_type_argument (Qchar_or_string_p, obj); } DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0,