diff options
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 24e9c3fcbc8..8623bed08e6 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -60,6 +60,14 @@ enum { BEG = 1, BEG_BYTE = BEG }; | |||
| 60 | 60 | ||
| 61 | /* Macros for the addresses of places in the buffer. */ | 61 | /* Macros for the addresses of places in the buffer. */ |
| 62 | 62 | ||
| 63 | /* WARNING: Use the 'char *' pointers to buffer text with care in code | ||
| 64 | that could GC: GC can relocate buffer text, invalidating such | ||
| 65 | pointers. It is best to use character or byte position instead, | ||
| 66 | delaying the access through BYTE_POS_ADDR etc. pointers to the | ||
| 67 | latest possible moment. If you must use the 'char *' pointers | ||
| 68 | (e.g., for speed), be sure to adjust them after any call that could | ||
| 69 | potentially GC. */ | ||
| 70 | |||
| 63 | /* Address of beginning of buffer. */ | 71 | /* Address of beginning of buffer. */ |
| 64 | #define BEG_ADDR (current_buffer->text->beg) | 72 | #define BEG_ADDR (current_buffer->text->beg) |
| 65 | 73 | ||
| @@ -1002,6 +1010,9 @@ SET_BUF_PT_BOTH (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t byte) | |||
| 1002 | or convert between a byte position and an address. | 1010 | or convert between a byte position and an address. |
| 1003 | These functions do not check that the position is in range. */ | 1011 | These functions do not check that the position is in range. */ |
| 1004 | 1012 | ||
| 1013 | /* See the important WARNING above about using the 'char *' pointers | ||
| 1014 | returned by these functions. */ | ||
| 1015 | |||
| 1005 | /* Return the address of byte position N in current buffer. */ | 1016 | /* Return the address of byte position N in current buffer. */ |
| 1006 | 1017 | ||
| 1007 | INLINE unsigned char * | 1018 | INLINE unsigned char * |