aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.h
diff options
context:
space:
mode:
authorPaul Eggert2016-12-25 09:17:02 -0800
committerPaul Eggert2016-12-25 09:17:50 -0800
commitf5b9c1e59653ac687806f6f84181fc3f5020e6ba (patch)
tree316a0b30906c467aed07e031d6108cba194a5636 /src/buffer.h
parente5ef59b87da5c2ddfa22f7342efe29b3eea6ed97 (diff)
downloademacs-f5b9c1e59653ac687806f6f84181fc3f5020e6ba.tar.gz
emacs-f5b9c1e59653ac687806f6f84181fc3f5020e6ba.zip
Reorder lisp.h to declare types before using them
This puts basic functions for types to be after the corresponding type definitions. This is a more-common programming style in C, and will make it easier to port Emacs to gcc -fcheck-pointer-bounds, since the functions now have access to the corresponding types' sizes. This patch does not change the code; it just moves declarations and definitions and removes no-longer-needed forward declarations (Bug#25128). * src/buffer.c, src/data.c, src/image.c: Include process.h, for PROCESSP. * src/buffer.h (BUFFERP, CHECK_BUFFER, XBUFFER): * src/process.h (PROCESSP, CHECK_PROCESS, XPROCESS): * src/termhooks.h (TERMINALP, XTERMINAL): * src/window.h (WINDOWP, CHECK_WINDOW, XWINDOW): * src/thread.h (THREADP, CHECK_THREAD, XTHREAD, MUTEXP, CHECK_MUTEX) (XMUTEX, CONDVARP, CHECK_CONDVAR, XCONDVAR): Move here from lisp.h. * src/intervals.h: Include buffer.h, for BUFFERP. Include lisp.h, for Lisp_Object. * src/lisp.h: Reorder declarations and definitions as described above. Move thread includes to be later, so that they can use the reordered definitions. Move some symbols to other headers (noted elsewhere). Remove forward decls that are no longer needed. * src/thread.h: Include systhread.h here, not in lisp.h, since lisp.h itself does not need systhread.h.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 854b5b5dd32..e2f94f1501b 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -881,6 +881,25 @@ struct buffer
881 Lisp_Object undo_list_; 881 Lisp_Object undo_list_;
882}; 882};
883 883
884INLINE bool
885BUFFERP (Lisp_Object a)
886{
887 return PSEUDOVECTORP (a, PVEC_BUFFER);
888}
889
890INLINE void
891CHECK_BUFFER (Lisp_Object x)
892{
893 CHECK_TYPE (BUFFERP (x), Qbufferp, x);
894}
895
896INLINE struct buffer *
897XBUFFER (Lisp_Object a)
898{
899 eassert (BUFFERP (a));
900 return XUNTAG (a, Lisp_Vectorlike);
901}
902
884/* Most code should use these functions to set Lisp fields in struct 903/* Most code should use these functions to set Lisp fields in struct
885 buffer. (Some setters that are private to a single .c file are 904 buffer. (Some setters that are private to a single .c file are
886 defined as static in those files.) */ 905 defined as static in those files.) */