diff options
| author | Paul Eggert | 2013-09-20 08:34:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-09-20 08:34:36 -0700 |
| commit | 00382e8b9834e58203507d0461884671b78ebc01 (patch) | |
| tree | cf28670199af0c1189cbcfbd14ffa49cbaaa0fba /src/buffer.h | |
| parent | 2fd3a9f7491a59d427150fab0ad4df6ea12b3249 (diff) | |
| download | emacs-00382e8b9834e58203507d0461884671b78ebc01.tar.gz emacs-00382e8b9834e58203507d0461884671b78ebc01.zip | |
A simpler, centralized INLINE.
* lib-src/profile.c (INLINE): New macro.
(SYSTIME_INLINE): Remove.
* src/conf_post.h (INLINE): Define only if not already defined.
This allows us to use a single INLINE, defined by one file
per executable.
* src/emacs.c (INLINE): Define it.
Also, include category.h, charset.h, composite.h, dispextern.h,
syntax.h, systime.h, so that their INLINE definitions are expanded
properly for Emacs.
* src/blockinput.h, src/keyboard.c (BLOCKINPUT_INLINE):
* src/buffer.h, src/buffer.c (BUFFER_INLINE):
* src/category.h, src/category.c (CATEGORY_INLINE):
* src/character.h, src/character.c (CHARACTER_INLINE):
* src/charset.h, src/charset.c (CHARSET_INLINE):
* src/composite.h, src/composite.c (COMPOSITE_INLINE):
* src/dispextern.h, src/dispnew.c (DISPEXTERN_INLINE):
* src/frame.h, src/frame.c (FRAME_INLINE):
* src/intervals.h, src/intervals.c (INTERVALS_INLINE):
* src/keyboard.h, src/keyboard.c (KEYBOARD_INLINE):
* src/lisp.h, src/alloc.c (LISP_INLINE):
* src/process.h, src/process.c (PROCESS_INLINE):
* src/syntax.h, src/syntax.c (SYNTAX_INLINE):
* src/systime.h, src/sysdep.c (SYSTIME_INLINE):
* src/termhooks.h, src/terminal.h (TERMHOOKS_INLINE):
* src/window.h, src/window.c (WINDOW_INLINE):
Remove. All uses replaced with INLINE.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/src/buffer.h b/src/buffer.h index 169a15c7d0f..a36c0d13c9e 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -22,9 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <time.h> | 22 | #include <time.h> |
| 23 | 23 | ||
| 24 | INLINE_HEADER_BEGIN | 24 | INLINE_HEADER_BEGIN |
| 25 | #ifndef BUFFER_INLINE | ||
| 26 | # define BUFFER_INLINE INLINE | ||
| 27 | #endif | ||
| 28 | 25 | ||
| 29 | /* Accessing the parameters of the current buffer. */ | 26 | /* Accessing the parameters of the current buffer. */ |
| 30 | 27 | ||
| @@ -875,97 +872,97 @@ struct buffer | |||
| 875 | 872 | ||
| 876 | /* Most code should use these functions to set Lisp fields in struct | 873 | /* Most code should use these functions to set Lisp fields in struct |
| 877 | buffer. */ | 874 | buffer. */ |
| 878 | BUFFER_INLINE void | 875 | INLINE void |
| 879 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) | 876 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) |
| 880 | { | 877 | { |
| 881 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; | 878 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; |
| 882 | } | 879 | } |
| 883 | BUFFER_INLINE void | 880 | INLINE void |
| 884 | bset_case_canon_table (struct buffer *b, Lisp_Object val) | 881 | bset_case_canon_table (struct buffer *b, Lisp_Object val) |
| 885 | { | 882 | { |
| 886 | b->INTERNAL_FIELD (case_canon_table) = val; | 883 | b->INTERNAL_FIELD (case_canon_table) = val; |
| 887 | } | 884 | } |
| 888 | BUFFER_INLINE void | 885 | INLINE void |
| 889 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) | 886 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) |
| 890 | { | 887 | { |
| 891 | b->INTERNAL_FIELD (case_eqv_table) = val; | 888 | b->INTERNAL_FIELD (case_eqv_table) = val; |
| 892 | } | 889 | } |
| 893 | BUFFER_INLINE void | 890 | INLINE void |
| 894 | bset_directory (struct buffer *b, Lisp_Object val) | 891 | bset_directory (struct buffer *b, Lisp_Object val) |
| 895 | { | 892 | { |
| 896 | b->INTERNAL_FIELD (directory) = val; | 893 | b->INTERNAL_FIELD (directory) = val; |
| 897 | } | 894 | } |
| 898 | BUFFER_INLINE void | 895 | INLINE void |
| 899 | bset_display_count (struct buffer *b, Lisp_Object val) | 896 | bset_display_count (struct buffer *b, Lisp_Object val) |
| 900 | { | 897 | { |
| 901 | b->INTERNAL_FIELD (display_count) = val; | 898 | b->INTERNAL_FIELD (display_count) = val; |
| 902 | } | 899 | } |
| 903 | BUFFER_INLINE void | 900 | INLINE void |
| 904 | bset_display_time (struct buffer *b, Lisp_Object val) | 901 | bset_display_time (struct buffer *b, Lisp_Object val) |
| 905 | { | 902 | { |
| 906 | b->INTERNAL_FIELD (display_time) = val; | 903 | b->INTERNAL_FIELD (display_time) = val; |
| 907 | } | 904 | } |
| 908 | BUFFER_INLINE void | 905 | INLINE void |
| 909 | bset_downcase_table (struct buffer *b, Lisp_Object val) | 906 | bset_downcase_table (struct buffer *b, Lisp_Object val) |
| 910 | { | 907 | { |
| 911 | b->INTERNAL_FIELD (downcase_table) = val; | 908 | b->INTERNAL_FIELD (downcase_table) = val; |
| 912 | } | 909 | } |
| 913 | BUFFER_INLINE void | 910 | INLINE void |
| 914 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) | 911 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) |
| 915 | { | 912 | { |
| 916 | b->INTERNAL_FIELD (enable_multibyte_characters) = val; | 913 | b->INTERNAL_FIELD (enable_multibyte_characters) = val; |
| 917 | } | 914 | } |
| 918 | BUFFER_INLINE void | 915 | INLINE void |
| 919 | bset_filename (struct buffer *b, Lisp_Object val) | 916 | bset_filename (struct buffer *b, Lisp_Object val) |
| 920 | { | 917 | { |
| 921 | b->INTERNAL_FIELD (filename) = val; | 918 | b->INTERNAL_FIELD (filename) = val; |
| 922 | } | 919 | } |
| 923 | BUFFER_INLINE void | 920 | INLINE void |
| 924 | bset_keymap (struct buffer *b, Lisp_Object val) | 921 | bset_keymap (struct buffer *b, Lisp_Object val) |
| 925 | { | 922 | { |
| 926 | b->INTERNAL_FIELD (keymap) = val; | 923 | b->INTERNAL_FIELD (keymap) = val; |
| 927 | } | 924 | } |
| 928 | BUFFER_INLINE void | 925 | INLINE void |
| 929 | bset_last_selected_window (struct buffer *b, Lisp_Object val) | 926 | bset_last_selected_window (struct buffer *b, Lisp_Object val) |
| 930 | { | 927 | { |
| 931 | b->INTERNAL_FIELD (last_selected_window) = val; | 928 | b->INTERNAL_FIELD (last_selected_window) = val; |
| 932 | } | 929 | } |
| 933 | BUFFER_INLINE void | 930 | INLINE void |
| 934 | bset_local_var_alist (struct buffer *b, Lisp_Object val) | 931 | bset_local_var_alist (struct buffer *b, Lisp_Object val) |
| 935 | { | 932 | { |
| 936 | b->INTERNAL_FIELD (local_var_alist) = val; | 933 | b->INTERNAL_FIELD (local_var_alist) = val; |
| 937 | } | 934 | } |
| 938 | BUFFER_INLINE void | 935 | INLINE void |
| 939 | bset_mark_active (struct buffer *b, Lisp_Object val) | 936 | bset_mark_active (struct buffer *b, Lisp_Object val) |
| 940 | { | 937 | { |
| 941 | b->INTERNAL_FIELD (mark_active) = val; | 938 | b->INTERNAL_FIELD (mark_active) = val; |
| 942 | } | 939 | } |
| 943 | BUFFER_INLINE void | 940 | INLINE void |
| 944 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) | 941 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) |
| 945 | { | 942 | { |
| 946 | b->INTERNAL_FIELD (point_before_scroll) = val; | 943 | b->INTERNAL_FIELD (point_before_scroll) = val; |
| 947 | } | 944 | } |
| 948 | BUFFER_INLINE void | 945 | INLINE void |
| 949 | bset_read_only (struct buffer *b, Lisp_Object val) | 946 | bset_read_only (struct buffer *b, Lisp_Object val) |
| 950 | { | 947 | { |
| 951 | b->INTERNAL_FIELD (read_only) = val; | 948 | b->INTERNAL_FIELD (read_only) = val; |
| 952 | } | 949 | } |
| 953 | BUFFER_INLINE void | 950 | INLINE void |
| 954 | bset_truncate_lines (struct buffer *b, Lisp_Object val) | 951 | bset_truncate_lines (struct buffer *b, Lisp_Object val) |
| 955 | { | 952 | { |
| 956 | b->INTERNAL_FIELD (truncate_lines) = val; | 953 | b->INTERNAL_FIELD (truncate_lines) = val; |
| 957 | } | 954 | } |
| 958 | BUFFER_INLINE void | 955 | INLINE void |
| 959 | bset_undo_list (struct buffer *b, Lisp_Object val) | 956 | bset_undo_list (struct buffer *b, Lisp_Object val) |
| 960 | { | 957 | { |
| 961 | b->INTERNAL_FIELD (undo_list) = val; | 958 | b->INTERNAL_FIELD (undo_list) = val; |
| 962 | } | 959 | } |
| 963 | BUFFER_INLINE void | 960 | INLINE void |
| 964 | bset_upcase_table (struct buffer *b, Lisp_Object val) | 961 | bset_upcase_table (struct buffer *b, Lisp_Object val) |
| 965 | { | 962 | { |
| 966 | b->INTERNAL_FIELD (upcase_table) = val; | 963 | b->INTERNAL_FIELD (upcase_table) = val; |
| 967 | } | 964 | } |
| 968 | BUFFER_INLINE void | 965 | INLINE void |
| 969 | bset_width_table (struct buffer *b, Lisp_Object val) | 966 | bset_width_table (struct buffer *b, Lisp_Object val) |
| 970 | { | 967 | { |
| 971 | b->INTERNAL_FIELD (width_table) = val; | 968 | b->INTERNAL_FIELD (width_table) = val; |
| @@ -1089,7 +1086,7 @@ extern void set_buffer_if_live (Lisp_Object); | |||
| 1089 | windows than the selected one requires a select_window at some | 1086 | windows than the selected one requires a select_window at some |
| 1090 | time, and that increments windows_or_buffers_changed. */ | 1087 | time, and that increments windows_or_buffers_changed. */ |
| 1091 | 1088 | ||
| 1092 | BUFFER_INLINE void | 1089 | INLINE void |
| 1093 | set_buffer_internal (struct buffer *b) | 1090 | set_buffer_internal (struct buffer *b) |
| 1094 | { | 1091 | { |
| 1095 | if (current_buffer != b) | 1092 | if (current_buffer != b) |
| @@ -1099,7 +1096,7 @@ set_buffer_internal (struct buffer *b) | |||
| 1099 | /* Arrange to go back to the original buffer after the next | 1096 | /* Arrange to go back to the original buffer after the next |
| 1100 | call to unbind_to if the original buffer is still alive. */ | 1097 | call to unbind_to if the original buffer is still alive. */ |
| 1101 | 1098 | ||
| 1102 | BUFFER_INLINE void | 1099 | INLINE void |
| 1103 | record_unwind_current_buffer (void) | 1100 | record_unwind_current_buffer (void) |
| 1104 | { | 1101 | { |
| 1105 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); | 1102 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); |
| @@ -1138,7 +1135,7 @@ extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; | |||
| 1138 | 1135 | ||
| 1139 | /* Get text properties of B. */ | 1136 | /* Get text properties of B. */ |
| 1140 | 1137 | ||
| 1141 | BUFFER_INLINE INTERVAL | 1138 | INLINE INTERVAL |
| 1142 | buffer_intervals (struct buffer *b) | 1139 | buffer_intervals (struct buffer *b) |
| 1143 | { | 1140 | { |
| 1144 | eassert (b->text != NULL); | 1141 | eassert (b->text != NULL); |
| @@ -1147,7 +1144,7 @@ buffer_intervals (struct buffer *b) | |||
| 1147 | 1144 | ||
| 1148 | /* Set text properties of B to I. */ | 1145 | /* Set text properties of B to I. */ |
| 1149 | 1146 | ||
| 1150 | BUFFER_INLINE void | 1147 | INLINE void |
| 1151 | set_buffer_intervals (struct buffer *b, INTERVAL i) | 1148 | set_buffer_intervals (struct buffer *b, INTERVAL i) |
| 1152 | { | 1149 | { |
| 1153 | eassert (b->text != NULL); | 1150 | eassert (b->text != NULL); |
| @@ -1156,7 +1153,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i) | |||
| 1156 | 1153 | ||
| 1157 | /* Non-zero if current buffer has overlays. */ | 1154 | /* Non-zero if current buffer has overlays. */ |
| 1158 | 1155 | ||
| 1159 | BUFFER_INLINE bool | 1156 | INLINE bool |
| 1160 | buffer_has_overlays (void) | 1157 | buffer_has_overlays (void) |
| 1161 | { | 1158 | { |
| 1162 | return current_buffer->overlays_before || current_buffer->overlays_after; | 1159 | return current_buffer->overlays_before || current_buffer->overlays_after; |
| @@ -1176,7 +1173,7 @@ buffer_has_overlays (void) | |||
| 1176 | the buffer to the next character after fetching this one. Instead, | 1173 | the buffer to the next character after fetching this one. Instead, |
| 1177 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ | 1174 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ |
| 1178 | 1175 | ||
| 1179 | BUFFER_INLINE int | 1176 | INLINE int |
| 1180 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | 1177 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) |
| 1181 | { | 1178 | { |
| 1182 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) | 1179 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) |
| @@ -1188,7 +1185,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | |||
| 1188 | If POS doesn't point the head of valid multi-byte form, only the byte at | 1185 | If POS doesn't point the head of valid multi-byte form, only the byte at |
| 1189 | POS is returned. No range checking. */ | 1186 | POS is returned. No range checking. */ |
| 1190 | 1187 | ||
| 1191 | BUFFER_INLINE int | 1188 | INLINE int |
| 1192 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | 1189 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) |
| 1193 | { | 1190 | { |
| 1194 | unsigned char *p | 1191 | unsigned char *p |
| @@ -1199,7 +1196,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | |||
| 1199 | 1196 | ||
| 1200 | /* Return number of windows showing B. */ | 1197 | /* Return number of windows showing B. */ |
| 1201 | 1198 | ||
| 1202 | BUFFER_INLINE int | 1199 | INLINE int |
| 1203 | buffer_window_count (struct buffer *b) | 1200 | buffer_window_count (struct buffer *b) |
| 1204 | { | 1201 | { |
| 1205 | if (b->base_buffer) | 1202 | if (b->base_buffer) |
| @@ -1306,13 +1303,13 @@ extern int last_per_buffer_idx; | |||
| 1306 | /* Functions to get and set default value of the per-buffer | 1303 | /* Functions to get and set default value of the per-buffer |
| 1307 | variable at offset OFFSET in the buffer structure. */ | 1304 | variable at offset OFFSET in the buffer structure. */ |
| 1308 | 1305 | ||
| 1309 | BUFFER_INLINE Lisp_Object | 1306 | INLINE Lisp_Object |
| 1310 | per_buffer_default (int offset) | 1307 | per_buffer_default (int offset) |
| 1311 | { | 1308 | { |
| 1312 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); | 1309 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); |
| 1313 | } | 1310 | } |
| 1314 | 1311 | ||
| 1315 | BUFFER_INLINE void | 1312 | INLINE void |
| 1316 | set_per_buffer_default (int offset, Lisp_Object value) | 1313 | set_per_buffer_default (int offset, Lisp_Object value) |
| 1317 | { | 1314 | { |
| 1318 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; | 1315 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; |
| @@ -1321,20 +1318,20 @@ set_per_buffer_default (int offset, Lisp_Object value) | |||
| 1321 | /* Functions to get and set buffer-local value of the per-buffer | 1318 | /* Functions to get and set buffer-local value of the per-buffer |
| 1322 | variable at offset OFFSET in the buffer structure. */ | 1319 | variable at offset OFFSET in the buffer structure. */ |
| 1323 | 1320 | ||
| 1324 | BUFFER_INLINE Lisp_Object | 1321 | INLINE Lisp_Object |
| 1325 | per_buffer_value (struct buffer *b, int offset) | 1322 | per_buffer_value (struct buffer *b, int offset) |
| 1326 | { | 1323 | { |
| 1327 | return *(Lisp_Object *)(offset + (char *) b); | 1324 | return *(Lisp_Object *)(offset + (char *) b); |
| 1328 | } | 1325 | } |
| 1329 | 1326 | ||
| 1330 | BUFFER_INLINE void | 1327 | INLINE void |
| 1331 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) | 1328 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) |
| 1332 | { | 1329 | { |
| 1333 | *(Lisp_Object *)(offset + (char *) b) = value; | 1330 | *(Lisp_Object *)(offset + (char *) b) = value; |
| 1334 | } | 1331 | } |
| 1335 | 1332 | ||
| 1336 | /* Downcase a character C, or make no change if that cannot be done. */ | 1333 | /* Downcase a character C, or make no change if that cannot be done. */ |
| 1337 | BUFFER_INLINE int | 1334 | INLINE int |
| 1338 | downcase (int c) | 1335 | downcase (int c) |
| 1339 | { | 1336 | { |
| 1340 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); | 1337 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); |
| @@ -1343,10 +1340,10 @@ downcase (int c) | |||
| 1343 | } | 1340 | } |
| 1344 | 1341 | ||
| 1345 | /* 1 if C is upper case. */ | 1342 | /* 1 if C is upper case. */ |
| 1346 | BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; } | 1343 | INLINE bool uppercasep (int c) { return downcase (c) != c; } |
| 1347 | 1344 | ||
| 1348 | /* Upcase a character C known to be not upper case. */ | 1345 | /* Upcase a character C known to be not upper case. */ |
| 1349 | BUFFER_INLINE int | 1346 | INLINE int |
| 1350 | upcase1 (int c) | 1347 | upcase1 (int c) |
| 1351 | { | 1348 | { |
| 1352 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); | 1349 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); |
| @@ -1355,13 +1352,13 @@ upcase1 (int c) | |||
| 1355 | } | 1352 | } |
| 1356 | 1353 | ||
| 1357 | /* 1 if C is lower case. */ | 1354 | /* 1 if C is lower case. */ |
| 1358 | BUFFER_INLINE bool | 1355 | INLINE bool |
| 1359 | lowercasep (int c) | 1356 | lowercasep (int c) |
| 1360 | { | 1357 | { |
| 1361 | return !uppercasep (c) && upcase1 (c) != c; | 1358 | return !uppercasep (c) && upcase1 (c) != c; |
| 1362 | } | 1359 | } |
| 1363 | 1360 | ||
| 1364 | /* Upcase a character C, or make no change if that cannot be done. */ | 1361 | /* Upcase a character C, or make no change if that cannot be done. */ |
| 1365 | BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } | 1362 | INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } |
| 1366 | 1363 | ||
| 1367 | INLINE_HEADER_END | 1364 | INLINE_HEADER_END |