Mercurial > hg > xemacs-beta
view src/insdel.h @ 5366:f00192e1cd49
Examining the result of #'length: `eql', not `=', it's better style & cheaper
2011-03-08 Aidan Kehoe <kehoea@parhasard.net>
* buff-menu.el (list-buffers-noselect):
* byte-optimize.el (byte-optimize-identity):
* byte-optimize.el (byte-optimize-if):
* byte-optimize.el (byte-optimize-nth):
* byte-optimize.el (byte-optimize-nthcdr):
* bytecomp.el (byte-compile-warn-wrong-args):
* bytecomp.el (byte-compile-two-args-19->20):
* bytecomp.el (byte-compile-list):
* bytecomp.el (byte-compile-beginning-of-line):
* bytecomp.el (byte-compile-set):
* bytecomp.el (byte-compile-set-default):
* bytecomp.el (byte-compile-values):
* bytecomp.el (byte-compile-values-list):
* bytecomp.el (byte-compile-integerp):
* bytecomp.el (byte-compile-multiple-value-list-internal):
* bytecomp.el (byte-compile-throw):
* cl-macs.el (cl-do-arglist):
* cl-macs.el (cl-parse-loop-clause):
* cl-macs.el (multiple-value-bind):
* cl-macs.el (multiple-value-setq):
* cl-macs.el (get-setf-method):
* cmdloop.el (command-error):
* cmdloop.el (y-or-n-p-minibuf):
* cmdloop.el (yes-or-no-p-minibuf):
* coding.el (unencodable-char-position):
* cus-edit.el (custom-face-prompt):
* cus-edit.el (custom-buffer-create-internal):
* cus-edit.el (widget-face-action):
* cus-edit.el (custom-group-value-create):
* descr-text.el (describe-char-unicode-data):
* dialog-gtk.el (popup-builtin-question-dialog):
* dragdrop.el (experimental-dragdrop-drop-log-function):
* dragdrop.el (experimental-dragdrop-drop-mime-default):
* easymenu.el (easy-menu-add):
* easymenu.el (easy-menu-remove):
* faces.el (read-face-name):
* faces.el (set-face-stipple):
* files.el (file-name-non-special):
* font.el (font-combine-fonts):
* font.el (font-set-face-font):
* font.el (font-parse-rgb-components):
* font.el (font-rgb-color-p):
* font.el (font-color-rgb-components):
* gnuserv.el (gnuserv-edit-files):
* help.el (key-or-menu-binding):
* help.el (function-documentation-1):
* help.el (function-documentation):
* info.el (info):
* isearch-mode.el (isearch-exit):
* isearch-mode.el (isearch-edit-string):
* isearch-mode.el (isearch-*-char):
* isearch-mode.el (isearch-complete1):
* ldap.el (ldap-encode-country-string):
* ldap.el (ldap-decode-string):
* minibuf.el (read-file-name-internal-1):
* minibuf.el (read-non-nil-coding-system):
* minibuf.el (get-user-response):
* mouse.el (drag-window-divider):
* mule/ccl.el:
* mule/ccl.el (ccl-compile-if):
* mule/ccl.el (ccl-compile-break):
* mule/ccl.el (ccl-compile-repeat):
* mule/ccl.el (ccl-compile-write-repeat):
* mule/ccl.el (ccl-compile-call):
* mule/ccl.el (ccl-compile-end):
* mule/ccl.el (ccl-compile-read-multibyte-character):
* mule/ccl.el (ccl-compile-write-multibyte-character):
* mule/ccl.el (ccl-compile-translate-character):
* mule/ccl.el (ccl-compile-mule-to-unicode):
* mule/ccl.el (ccl-compile-unicode-to-mule):
* mule/ccl.el (ccl-compile-lookup-integer):
* mule/ccl.el (ccl-compile-lookup-character):
* mule/ccl.el (ccl-compile-map-multiple):
* mule/ccl.el (ccl-compile-map-single):
* mule/devan-util.el (devanagari-compose-to-one-glyph):
* mule/devan-util.el (devanagari-composition-component):
* mule/mule-cmds.el (finish-set-language-environment):
* mule/viet-util.el:
* mule/viet-util.el (viet-encode-viscii-char):
* multicast.el (open-multicast-group):
* newcomment.el (comment-quote-nested):
* newcomment.el (comment-region):
* newcomment.el (comment-dwim):
* regexp-opt.el (regexp-opt-group):
* replace.el (map-query-replace-regexp):
* specifier.el (derive-device-type-from-tag-set):
* subr.el (skip-chars-quote):
* test-harness.el (test-harness-from-buffer):
* test-harness.el (batch-test-emacs):
* wid-edit.el (widget-choice-action):
* wid-edit.el (widget-symbol-prompt-internal):
* wid-edit.el (widget-color-action):
* window-xemacs.el (push-window-configuration):
* window-xemacs.el (pop-window-configuration):
* window.el (quit-window):
* x-compose.el (electric-diacritic):
It's better style, and cheaper (often one assembler instruction
vs. a C funcall in the byte code), to use `eql' instead of `='
when it's clear what numerical type a given result will be. Change
much of our code to do this, with the help of a byte-compiler
change (not comitted) that looked for calls to #'length (which
always returns an integer) in its args.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 08 Mar 2011 23:41:52 +0000 |
parents | 304aebb79cd3 |
children | 308d34e9f07d |
line wrap: on
line source
/* Buffer insertion/deletion and gap motion for XEmacs. Copyright (C) 1985-1994 Free Software Foundation, Inc. This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Synched up with: Not in FSF. */ /* Mostly rewritten by Ben Wing. */ #ifndef INCLUDED_insdel_h_ #define INCLUDED_insdel_h_ /************************************************************************/ /* changing a buffer's text */ /************************************************************************/ int begin_multiple_change (struct buffer *buf, Charbpos start, Charbpos end); void end_multiple_change (struct buffer *buf, int count); /* flags for functions below */ #define INSDEL_BEFORE_MARKERS 1 #define INSDEL_NO_LOCKING 2 Charcount buffer_insert_string_1 (struct buffer *buf, Charbpos pos, const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, int flags); Charcount buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos, const Ibyte *nonreloc, Bytecount length, int flags); Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos, Lisp_Object str, int flags); Charcount buffer_insert_ascstring_1 (struct buffer *buf, Charbpos pos, const Ascbyte *s, int flags); Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Ichar ch, int flags); Charcount buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c, int flags); Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos, struct buffer *buf2, Charbpos pos2, Charcount length, int flags); /* Macros for insertion functions that insert at point after markers. All of these can GC. */ #define buffer_insert_string(buf, nonreloc, reloc, offset, length) \ buffer_insert_string_1 (buf, -1, nonreloc, reloc, offset, length, 0) #define buffer_insert_raw_string(buf, string, length) \ buffer_insert_raw_string_1 (buf, -1, string, length, 0) #define buffer_insert_ascstring(buf, s) \ buffer_insert_ascstring_1 (buf, -1, s, 0) #define buffer_insert_lisp_string(buf, str) \ buffer_insert_lisp_string_1 (buf, -1, str, 0) #define buffer_insert_c_char(buf, c) \ buffer_insert_c_char_1 (buf, -1, c, 0) #define buffer_insert_emacs_char(buf, ch) \ buffer_insert_emacs_char_1 (buf, -1, ch, 0) #define buffer_insert_from_buffer(buf, b, index, length) \ buffer_insert_from_buffer_1 (buf, -1, b, index, length, 0) void buffer_delete_range (struct buffer *buf, Charbpos from, Charbpos to, int flags); void buffer_replace_char (struct buffer *b, Charbpos pos, Ichar ch, int not_real_change, int force_lock_check); /************************************************************************/ /* tracking buffer changes */ /************************************************************************/ /* Split into two parts. One part goes with a buffer's text (possibly shared), the other with the buffer itself. */ struct buffer_text_change_data { /* multiple change stuff */ int in_multiple_change; Charbpos mc_begin, mc_orig_end, mc_new_end; int mc_begin_signaled; }; struct each_buffer_change_data { Charcount begin_unchanged, end_unchanged; /* redisplay needs to know if a newline was deleted so its incremental-redisplay algorithm will fail */ int newline_was_deleted; Charcount begin_extent_unchanged, end_extent_unchanged; }; /* Number of characters at the beginning and end of the buffer that have not changed since the last call to buffer_reset_changes(). If no changes have occurred since then, both values will be -1. "Changed" means that the text has changed. */ #define BUF_BEGIN_UNCHANGED(buf) ((buf)->changes->begin_unchanged) #define BUF_END_UNCHANGED(buf) ((buf)->changes->end_unchanged) /* Number of characters at the beginning and end of the buffer that have not had a covering extent change since the last call to buffer_reset_changes (). If no changes have occurred since then, both values will be -1. "Changed" means that the extents covering the text have changed. */ #define BUF_EXTENT_BEGIN_UNCHANGED(buf) \ ((buf)->changes->begin_extent_unchanged) #define BUF_EXTENT_END_UNCHANGED(buf) \ ((buf)->changes->end_extent_unchanged) #define BUF_NEWLINE_WAS_DELETED(buf) \ ((buf)->changes->newline_was_deleted) void buffer_extent_signal_changed_region (struct buffer *buf, Charbpos start, Charbpos end); void buffer_reset_changes (struct buffer *buf); /************************************************************************/ /* other related functions */ /************************************************************************/ Membpos do_marker_adjustment (Membpos mpos, Membpos from, Membpos to, Bytecount amount); void fixup_internal_substring (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount *len); /* In font-lock.c */ void font_lock_maybe_update_syntactic_caches (struct buffer *buf, Charbpos start, Charbpos orig_end, Charbpos new_end); void font_lock_buffer_was_killed (struct buffer *buf); void barf_if_buffer_read_only (struct buffer *buf, Charbpos from, Charbpos to); void init_buffer_text (struct buffer *b); void uninit_buffer_text (struct buffer *b); #endif /* INCLUDED_insdel_h_ */