------------------------------------------------------------ revno: 117506 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2014-07-10 08:35:55 +0400 message: * coding.h (struct coding_system): Remove 'error_positions' (unused) and 'errors' (set but unused) fields. Use bitfields for 'eol_seen', 'mode', 'common_flags' and 'result' fields, adjust layout to avoid extra padding and shrink struct coding_system by 56 bytes (x86_64). * coding.c (decode_coding_utf_8, decode_coding_utf_16) (decode_coding_emacs_mule, decode_coding_iso_2022, decode_coding_sjis) (decode_coding_big5, decode_coding_charset, decode_coding) (encode_coding): Adjust users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-09 23:39:58 +0000 +++ src/ChangeLog 2014-07-10 04:35:55 +0000 @@ -1,3 +1,14 @@ +2014-07-10 Dmitry Antipov + + * coding.h (struct coding_system): Remove 'error_positions' (unused) + and 'errors' (set but unused) fields. Use bitfields for 'eol_seen', + 'mode', 'common_flags' and 'result' fields, adjust layout to avoid + extra padding and shrink struct coding_system by 56 bytes (x86_64). + * coding.c (decode_coding_utf_8, decode_coding_utf_16) + (decode_coding_emacs_mule, decode_coding_iso_2022, decode_coding_sjis) + (decode_coding_big5, decode_coding_charset, decode_coding) + (encode_coding): Adjust users. + 2014-07-09 Paul Eggert * syntax.c (back_comment): Use more-natural location for label. === modified file 'src/coding.c' --- src/coding.c 2014-07-09 10:36:35 +0000 +++ src/coding.c 2014-07-10 04:35:55 +0000 @@ -1486,7 +1486,6 @@ consumed_chars = consumed_chars_base; ONE_MORE_BYTE (c); *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); - coding->errors++; } no_more_source: @@ -1685,7 +1684,6 @@ /* The first two bytes are not BOM. Treat them as bytes for a normal character. */ src = src_base; - coding->errors++; } CODING_UTF_16_BOM (coding) = utf_without_bom; } @@ -1742,7 +1740,6 @@ c1 = surrogate & 0xFF, c2 = surrogate >> 8; *charbuf++ = c1; *charbuf++ = c2; - coding->errors++; if (UTF_16_HIGH_SURROGATE_P (c)) CODING_UTF_16_SURROGATE (coding) = surrogate = c; else @@ -2598,7 +2595,6 @@ ONE_MORE_BYTE (c); *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; - coding->errors++; } no_more_source: @@ -4006,7 +4002,6 @@ ONE_MORE_BYTE (c); *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; - coding->errors++; /* Reset the invocation and designation status to the safest one; i.e. designate ASCII to the graphic register 0, and invoke that register to the graphic plane 0. This typically @@ -4837,7 +4832,6 @@ ONE_MORE_BYTE (c); *charbuf++ = c < 0 ? -c : BYTE8_TO_CHAR (c); char_offset++; - coding->errors++; } no_more_source: @@ -4933,7 +4927,6 @@ ONE_MORE_BYTE (c); *charbuf++ = c < 0 ? -c : BYTE8_TO_CHAR (c); char_offset++; - coding->errors++; } no_more_source: @@ -5642,7 +5635,6 @@ ONE_MORE_BYTE (c); *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; - coding->errors++; } no_more_source: @@ -7375,7 +7367,6 @@ coding->produced = coding->produced_char = 0; coding->chars_at_source = 0; record_conversion_result (coding, CODING_RESULT_SUCCESS); - coding->errors = 0; ALLOC_CONVERSION_WORK_AREA (coding, coding->src_bytes); @@ -7771,7 +7762,6 @@ coding->consumed = coding->consumed_char = 0; coding->produced = coding->produced_char = 0; record_conversion_result (coding, CODING_RESULT_SUCCESS); - coding->errors = 0; ALLOC_CONVERSION_WORK_AREA (coding, coding->src_chars); === modified file 'src/coding.h' --- src/coding.h 2014-04-05 19:30:36 +0000 +++ src/coding.h 2014-07-10 04:35:55 +0000 @@ -434,11 +434,37 @@ /* Flag bits of the coding system. The meaning of each bit is common to all types of coding systems. */ - int common_flags; + unsigned common_flags : 14; /* Mode bits of the coding system. See the comments of the macros CODING_MODE_XXX. */ - unsigned int mode; + unsigned mode : 5; + + /* The following two members specify how binary 8-bit code 128..255 + are represented in source and destination text respectively. True + means they are represented by 2-byte sequence, false means they are + represented by 1-byte as is (see the comment in character.h). */ + bool_bf src_multibyte : 1; + bool_bf dst_multibyte : 1; + + /* True if the source of conversion is not in the member + `charbuf', but at `src_object'. */ + bool_bf chars_at_source : 1; + + /* Nonzero if the result of conversion is in `destination' + buffer rather than in `dst_object'. */ + bool_bf raw_destination : 1; + + /* Set to true if charbuf contains an annotation. */ + bool_bf annotated : 1; + + /* Used internally in coding.c. See the comment of detect_ascii. */ + unsigned eol_seen : 3; + + /* Finish status of code conversion. */ + ENUM_BF (coding_result_code) result : 3; + + int max_charset_id; /* Detailed information specific to each type of coding system. */ union @@ -451,16 +477,8 @@ struct undecided_spec undecided; } spec; - int max_charset_id; unsigned char *safe_charsets; - /* The following two members specify how binary 8-bit code 128..255 - are represented in source and destination text respectively. True - means they are represented by 2-byte sequence, false means they are - represented by 1-byte as is (see the comment in character.h). */ - bool_bf src_multibyte : 1; - bool_bf dst_multibyte : 1; - /* How may heading bytes we can skip for decoding. This is set to -1 in setup_coding_system, and updated by detect_coding. So, when this is equal to the byte length of the text being @@ -472,21 +490,9 @@ sequence. Set by detect_coding_utf_8. */ ptrdiff_t detected_utf8_bytes, detected_utf8_chars; - /* Used internally in coding.c. See the comment of detect_ascii. */ - int eol_seen; - /* The following members are set by encoding/decoding routine. */ ptrdiff_t produced, produced_char, consumed, consumed_char; - /* Number of error source data found in a decoding routine. */ - ptrdiff_t errors; - - /* Store the positions of error source data. */ - ptrdiff_t *error_positions; - - /* Finish status of code conversion. */ - enum coding_result_code result; - ptrdiff_t src_pos, src_pos_byte, src_chars, src_bytes; Lisp_Object src_object; const unsigned char *source; @@ -510,17 +516,6 @@ int *charbuf; int charbuf_size, charbuf_used; - /* True if the source of conversion is not in the member - `charbuf', but at `src_object'. */ - bool_bf chars_at_source : 1; - - /* Nonzero if the result of conversion is in `destination' - buffer rather than in `dst_object'. */ - bool_bf raw_destination : 1; - - /* Set to true if charbuf contains an annotation. */ - bool_bf annotated : 1; - unsigned char carryover[64]; int carryover_bytes; ------------------------------------------------------------ revno: 117505 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-07-09 16:39:58 -0700 message: * syntax.c (back_comment): Use more-natural location for label. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-09 23:35:31 +0000 +++ src/ChangeLog 2014-07-09 23:39:58 +0000 @@ -1,5 +1,7 @@ 2014-07-09 Paul Eggert + * syntax.c (back_comment): Use more-natural location for label. + * font.c, font.h (font_unparse_fcname): Now static. Define only if HAVE_XFT || HAVE_FREETYPE || HAVE_NS. === modified file 'src/syntax.c' --- src/syntax.c 2014-07-05 02:17:14 +0000 +++ src/syntax.c 2014-07-09 23:39:58 +0000 @@ -835,12 +835,10 @@ from_byte = comstart_byte; UPDATE_SYNTAX_TABLE_FORWARD (from - 1); } - else + else lossage: { struct lisp_parse_state state; - bool adjusted; - lossage: - adjusted = true; + bool adjusted = true; /* We had two kinds of string delimiters mixed up together. Decode this going forwards. Scan fwd from a known safe place (beginning-of-defun) ------------------------------------------------------------ revno: 117504 committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-07-09 16:35:31 -0700 message: * font.c, font.h (font_unparse_fcname): Now static. Define only if HAVE_XFT || HAVE_FREETYPE || HAVE_NS. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-09 10:36:35 +0000 +++ src/ChangeLog 2014-07-09 23:35:31 +0000 @@ -1,3 +1,8 @@ +2014-07-09 Paul Eggert + + * font.c, font.h (font_unparse_fcname): Now static. + Define only if HAVE_XFT || HAVE_FREETYPE || HAVE_NS. + 2014-07-09 Dmitry Antipov Next minor cleanup of font subsystem. === modified file 'src/font.c' --- src/font.c 2014-07-08 14:50:45 +0000 +++ src/font.c 2014-07-09 23:35:31 +0000 @@ -227,6 +227,8 @@ #if defined (HAVE_XFT) || defined (HAVE_FREETYPE) || defined (HAVE_NS) +static int font_unparse_fcname (Lisp_Object, int, char *, int); + /* Like above, but also set `type', `name' and `fullname' properties of font-object. */ @@ -1599,11 +1601,14 @@ return 0; } +#if defined HAVE_XFT || defined HAVE_FREETYPE || defined HAVE_NS + /* Store fontconfig's font name of FONT (font-spec or font-entity) in NAME (NBYTES length), and return the name length. If - FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. */ + FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. + Return a negative value on error. */ -int +static int font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) { Lisp_Object family, foundry; @@ -1724,6 +1729,8 @@ return (p - name); } +#endif + /* Parse NAME (null terminated) and store information in FONT (font-spec or font-entity). If NAME is successfully parsed, return 0. Otherwise return -1. */ === modified file 'src/font.h' --- src/font.h 2014-07-09 06:25:35 +0000 +++ src/font.h 2014-07-09 23:35:31 +0000 @@ -752,8 +752,6 @@ extern int font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font); extern ptrdiff_t font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int bytes); -extern int font_unparse_fcname (Lisp_Object font, int pixel_size, - char *name, int bytes); extern void register_font_driver (struct font_driver *driver, struct frame *f); extern void free_font_driver_list (struct frame *f); #ifdef ENABLE_CHECKING ------------------------------------------------------------ revno: 117503 committer: Sam Steingold branch nick: trunk timestamp: Wed 2014-07-09 10:51:52 -0400 message: Treat the perl keyword `constant' like `bless', `return' &c * lisp/progmodes/cperl-mode.el (cperl-block-p): Tread the perl keyword `constant' like `bless', `return' &c diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-07-09 02:20:21 +0000 +++ lisp/ChangeLog 2014-07-09 14:51:52 +0000 @@ -1,3 +1,8 @@ +2014-07-09 Sam Steingold + + * progmodes/cperl-mode.el (cperl-block-p): Treat the perl keyword + `constant' like `bless', `return' &c + 2014-07-09 Stefan Monnier * rect.el (apply-on-rectangle): Check forward-line really moved to the === modified file 'lisp/progmodes/cperl-mode.el' --- lisp/progmodes/cperl-mode.el 2014-01-16 06:24:06 +0000 +++ lisp/progmodes/cperl-mode.el 2014-07-09 14:51:52 +0000 @@ -4828,9 +4828,9 @@ (and (memq (char-syntax (preceding-char)) '(?w ?_)) (progn (backward-sexp) - ;; sub {BLK}, print {BLK} $data, but NOT `bless', `return', `tr' + ;; sub {BLK}, print {BLK} $data, but NOT `bless', `return', `tr', `constant' (or (and (looking-at "[a-zA-Z0-9_:]+[ \t\n\f]*[{#]") ; Method call syntax - (not (looking-at "\\(bless\\|return\\|q[wqrx]?\\|tr\\|[smy]\\)\\>"))) + (not (looking-at "\\(bless\\|return\\|q[wqrx]?\\|tr\\|[smy]\\|constant\\)\\>"))) ;; sub bless::foo {} (progn (cperl-backward-to-noncomment (point-min)) ------------------------------------------------------------ revno: 117502 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-07-09 14:36:35 +0400 message: * coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and so avoid integer overflow if decoded gap size exceeds INT_MAX bytes. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-09 06:25:35 +0000 +++ src/ChangeLog 2014-07-09 10:36:35 +0000 @@ -15,6 +15,9 @@ * xfont.c (xfont_open): * xftfont.c (xftfont_open): All users changed. + * coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and + so avoid integer overflow if decoded gap size exceeds INT_MAX bytes. + 2014-07-09 Eli Zaretskii * xdisp.c (move_it_to): Adjust calculation of line_start_x to what === modified file 'src/coding.c' --- src/coding.c 2014-07-01 15:34:58 +0000 +++ src/coding.c 2014-07-09 10:36:35 +0000 @@ -7273,15 +7273,12 @@ #define ALLOC_CONVERSION_WORK_AREA(coding, size) \ do { \ - int units = (size) + MAX_CHARBUF_EXTRA_SIZE; \ - \ - if (units > MAX_CHARBUF_SIZE) \ - units = MAX_CHARBUF_SIZE; \ - coding->charbuf = SAFE_ALLOCA ((units) * sizeof (int)); \ - coding->charbuf_size = (units); \ + ptrdiff_t units = min ((size) + MAX_CHARBUF_EXTRA_SIZE, \ + MAX_CHARBUF_SIZE); \ + coding->charbuf = SAFE_ALLOCA (units * sizeof (int)); \ + coding->charbuf_size = units; \ } while (0) - static void produce_annotation (struct coding_system *coding, ptrdiff_t pos) { ------------------------------------------------------------ revno: 117501 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-07-09 10:25:35 +0400 message: Next minor cleanup of font subsystem. * font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no users) and FONT_FORMAT_INDEX (set by a few font drivers but never really used). (FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove; unused. * ftfont.h (ftfont_font_format): Remove prototype. * ftfont.c (ftfont_font_format): Remove; now unused. (ftfont_open): * nsfont.m (nsfont_open): * w32font.c (w32font_open_internal): * w32uniscribe.c (uniscribe_open): * xfont.c (xfont_open): * xftfont.c (xftfont_open): All users changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-09 02:04:12 +0000 +++ src/ChangeLog 2014-07-09 06:25:35 +0000 @@ -1,3 +1,20 @@ +2014-07-09 Dmitry Antipov + + Next minor cleanup of font subsystem. + * font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no + users) and FONT_FORMAT_INDEX (set by a few font drivers but never + really used). + (FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove; + unused. + * ftfont.h (ftfont_font_format): Remove prototype. + * ftfont.c (ftfont_font_format): Remove; now unused. + (ftfont_open): + * nsfont.m (nsfont_open): + * w32font.c (w32font_open_internal): + * w32uniscribe.c (uniscribe_open): + * xfont.c (xfont_open): + * xftfont.c (xftfont_open): All users changed. + 2014-07-09 Eli Zaretskii * xdisp.c (move_it_to): Adjust calculation of line_start_x to what === modified file 'src/font.h' --- src/font.h 2014-07-08 14:50:45 +0000 +++ src/font.h 2014-07-09 06:25:35 +0000 @@ -162,9 +162,6 @@ /* List of font-objects opened from the font-entity. */ FONT_OBJLIST_INDEX = FONT_SPEC_MAX, - /* Font-entity from which the font-object is opened. */ - FONT_ENTITY_INDEX = FONT_SPEC_MAX, - /* This value is the length of font-entity vector. */ FONT_ENTITY_MAX, @@ -182,9 +179,6 @@ is not available. */ FONT_FILE_INDEX, - /* Format of the font (symbol) or nil if unknown. */ - FONT_FORMAT_INDEX, - /* This value is the length of font-object vector. */ FONT_OBJECT_MAX }; @@ -442,15 +436,6 @@ #define FONT_OBJECT_P(x) \ (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) -/* True iff ENTITY can't be loaded. */ -#define FONT_ENTITY_NOT_LOADABLE(entity) \ - EQ (AREF (entity, FONT_OBJLIST_INDEX), Qt) - -/* Flag ENTITY not loadable. */ -#define FONT_ENTITY_SET_NOT_LOADABLE(entity) \ - ASET (entity, FONT_OBJLIST_INDEX, Qt) - - /* Check macros for various font-related objects. */ #define CHECK_FONT(x) \ === modified file 'src/ftfont.c' --- src/ftfont.c 2014-07-08 14:50:45 +0000 +++ src/ftfont.c 2014-07-09 06:25:35 +0000 @@ -1223,7 +1223,6 @@ font_object = font_build_object (VECSIZE (struct ftfont_info), Qfreetype, entity, size); ASET (font_object, FONT_FILE_INDEX, filename); - ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename)); font = XFONT_OBJECT (font_object); ftfont_info = (struct ftfont_info *) font; ftfont_info->ft_size = ft_face->size; @@ -2587,46 +2586,6 @@ #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ #endif /* HAVE_LIBOTF */ -Lisp_Object -ftfont_font_format (FcPattern *pattern, Lisp_Object filename) -{ - FcChar8 *str; - -#ifdef FC_FONTFORMAT - if (pattern) - { - if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) - return Qnil; - if (strcmp ((char *) str, "TrueType") == 0) - return intern ("truetype"); - if (strcmp ((char *) str, "Type 1") == 0) - return intern ("type1"); - if (strcmp ((char *) str, "PCF") == 0) - return intern ("pcf"); - if (strcmp ((char *) str, "BDF") == 0) - return intern ("bdf"); - } -#endif /* FC_FONTFORMAT */ - if (STRINGP (filename)) - { - int len = SBYTES (filename); - - if (len >= 4) - { - str = (FcChar8 *) (SDATA (filename) + len - 4); - if (xstrcasecmp ((char *) str, ".ttf") == 0) - return intern ("truetype"); - if (xstrcasecmp ((char *) str, ".pfb") == 0) - return intern ("type1"); - if (xstrcasecmp ((char *) str, ".pcf") == 0) - return intern ("pcf"); - if (xstrcasecmp ((char *) str, ".bdf") == 0) - return intern ("bdf"); - } - } - return intern ("unknown"); -} - static const char *const ftfont_booleans [] = { ":antialias", ":hinting", === modified file 'src/ftfont.h' --- src/ftfont.h 2011-01-15 23:16:57 +0000 +++ src/ftfont.h 2014-07-09 06:25:35 +0000 @@ -36,7 +36,6 @@ #endif /* HAVE_M17N_FLT */ #endif /* HAVE_LIBOTF */ -extern Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); extern FcCharSet *ftfont_get_fc_charset (Lisp_Object); #endif /* EMACS_FTFONT_H */ === modified file 'src/nsfont.m' --- src/nsfont.m 2014-07-08 14:19:34 +0000 +++ src/nsfont.m 2014-07-09 06:25:35 +0000 @@ -830,9 +830,6 @@ font->baseline_offset = 0; font->relative_compose = 0; - font->props[FONT_FORMAT_INDEX] = Qns; - font->props[FONT_FILE_INDEX] = Qnil; - { const char *fontName = [[nsfont fontName] UTF8String]; === modified file 'src/w32font.c' --- src/w32font.c 2014-07-04 02:28:54 +0000 +++ src/w32font.c 2014-07-09 06:25:35 +0000 @@ -886,7 +886,7 @@ LOGFONT logfont; HDC dc; HFONT hfont, old_font; - Lisp_Object val, extra; + Lisp_Object val; struct w32font_info *w32_font; struct font * font; OUTLINETEXTMETRICW* metrics = NULL; @@ -979,21 +979,6 @@ font->default_ascent = w32_font->metrics.tmAscent; font->pixel_size = size; font->driver = &w32font_driver; - /* Use format cached during list, as the information we have access to - here is incomplete. */ - extra = AREF (font_entity, FONT_EXTRA_INDEX); - if (CONSP (extra)) - { - val = assq_no_quit (QCformat, extra); - if (CONSP (val)) - font->props[FONT_FORMAT_INDEX] = XCDR (val); - else - font->props[FONT_FORMAT_INDEX] = Qunknown; - } - else - font->props[FONT_FORMAT_INDEX] = Qunknown; - - font->props[FONT_FILE_INDEX] = Qnil; font->encoding_charset = -1; font->repertory_charset = -1; /* TODO: do we really want the minimum width here, which could be negative? */ === modified file 'src/w32uniscribe.c' --- src/w32uniscribe.c 2014-07-04 02:28:54 +0000 +++ src/w32uniscribe.c 2014-07-09 06:25:35 +0000 @@ -127,8 +127,6 @@ /* Uniscribe backend uses glyph indices. */ uniscribe_font->w32_font.glyph_idx = ETO_GLYPH_INDEX; - /* Mark the format as opentype */ - uniscribe_font->w32_font.font.props[FONT_FORMAT_INDEX] = Qopentype; uniscribe_font->w32_font.font.driver = &uniscribe_font_driver; return font_object; === modified file 'src/xfont.c' --- src/xfont.c 2014-07-04 02:28:54 +0000 +++ src/xfont.c 2014-07-09 06:25:35 +0000 @@ -804,8 +804,6 @@ ASET (font_object, FONT_NAME_INDEX, make_string (buf, len)); } ASET (font_object, FONT_FULLNAME_INDEX, fullname); - ASET (font_object, FONT_FILE_INDEX, Qnil); - ASET (font_object, FONT_FORMAT_INDEX, Qx); font = XFONT_OBJECT (font_object); ((struct xfont_info *) font)->xfont = xfont; ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f); === modified file 'src/xftfont.c' --- src/xftfont.c 2014-07-08 14:50:45 +0000 +++ src/xftfont.c 2014-07-09 06:25:35 +0000 @@ -343,8 +343,6 @@ font_object = font_build_object (VECSIZE (struct xftfont_info), Qxft, entity, size); ASET (font_object, FONT_FILE_INDEX, filename); - ASET (font_object, FONT_FORMAT_INDEX, - ftfont_font_format (xftfont->pattern, filename)); font = XFONT_OBJECT (font_object); font->pixel_size = size; font->driver = &xftfont_driver;