diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2012-08-20 11:42:06 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2012-08-20 11:42:06 +0400 |
commit | 4ce60d2ec56748e74fb56487b7761a2bdba1d644 (patch) | |
tree | 6dc415220c4199b029e638bca3dcb10c493f4b67 /src/buffer.h | |
parent | 36e8d1eb27b39ea35e9a57575858cb86a8784f2a (diff) | |
download | emacs-4ce60d2ec56748e74fb56487b7761a2bdba1d644.tar.gz |
Inline getter and setter functions for per-buffer values.
* buffer.h (per_buffer_default, set_per_buffer_default)
(per_buffer_value, set_per_buffer_value): New functions.
(PER_BUFFER_VALUE, PER_BUFFER_DEFAULT): Remove.
* buffer.c, data.c: Adjust users.
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/buffer.h b/src/buffer.h index 510a8e55682..6c63c52dc47 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1203,18 +1203,36 @@ extern int last_per_buffer_idx; #define PER_BUFFER_IDX(OFFSET) \ XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags)) -/* Return the default value of the per-buffer variable at offset - OFFSET in the buffer structure. */ +/* Functions to get and set default value of the per-buffer + variable at offset OFFSET in the buffer structure. */ -#define PER_BUFFER_DEFAULT(OFFSET) \ - (*(Lisp_Object *)((OFFSET) + (char *) &buffer_defaults)) +BUFFER_INLINE Lisp_Object +per_buffer_default (int offset) +{ + return *(Lisp_Object *)(offset + (char *) &buffer_defaults); +} -/* Return the buffer-local value of the per-buffer variable at offset - OFFSET in the buffer structure. */ +BUFFER_INLINE void +set_per_buffer_default (int offset, Lisp_Object value) +{ + *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; +} + +/* Functions to get and set buffer-local value of the per-buffer + variable at offset OFFSET in the buffer structure. */ + +BUFFER_INLINE Lisp_Object +per_buffer_value (struct buffer *b, int offset) +{ + return *(Lisp_Object *)(offset + (char *) b); +} + +BUFFER_INLINE void +set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) +{ + *(Lisp_Object *)(offset + (char *) b) = value; +} -#define PER_BUFFER_VALUE(BUFFER, OFFSET) \ - (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) - /* Downcase a character C, or make no change if that cannot be done. */ BUFFER_INLINE int downcase (int c) |