diff options
author | Joakim Verona <joakim@verona.se> | 2015-01-16 22:29:10 +0100 |
---|---|---|
committer | Joakim Verona <joakim@verona.se> | 2015-01-16 22:29:10 +0100 |
commit | 5e2255017323c54feeaaee220175d7761a3b6ed1 (patch) | |
tree | 3f843af60b826b63e12482301ce20745a95ede3e /src | |
parent | b64675500decba1c707bc5d5c6d57f633934778f (diff) | |
parent | 78e6ccc4a5006272b14f352e459a6d3bf52ed07b (diff) | |
download | emacs-5e2255017323c54feeaaee220175d7761a3b6ed1.tar.gz emacs-5e2255017323c54feeaaee220175d7761a3b6ed1.tar.bz2 emacs-5e2255017323c54feeaaee220175d7761a3b6ed1.zip |
merge master
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 56 | ||||
-rw-r--r-- | src/alloc.c | 64 | ||||
-rw-r--r-- | src/decompress.c | 3 | ||||
-rw-r--r-- | src/fileio.c | 50 | ||||
-rw-r--r-- | src/fns.c | 9 | ||||
-rw-r--r-- | src/font.c | 20 | ||||
-rw-r--r-- | src/font.h | 113 | ||||
-rw-r--r-- | src/frame.c | 7 | ||||
-rw-r--r-- | src/ftfont.c | 9 | ||||
-rw-r--r-- | src/gnutls.c | 20 | ||||
-rw-r--r-- | src/gtkutil.h | 2 | ||||
-rw-r--r-- | src/lisp.h | 37 | ||||
-rw-r--r-- | src/macfont.m | 10 | ||||
-rw-r--r-- | src/process.c | 15 | ||||
-rw-r--r-- | src/terminal.c | 9 | ||||
-rw-r--r-- | src/w32uniscribe.c | 8 | ||||
-rw-r--r-- | src/window.c | 11 | ||||
-rw-r--r-- | src/xdisp.c | 3 | ||||
-rw-r--r-- | src/xftfont.c | 6 | ||||
-rw-r--r-- | src/xmenu.c | 2 |
20 files changed, 300 insertions, 154 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b2588f1451f..16e2fa19626 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,59 @@ +2015-01-16 Dmitry Antipov <dmantipov@yandex.ru> + + Tune pseudovector allocation assuming Qnil == 0. + * alloc.c (allocate_pseudovector): Use memset for both + Lisp_Objects and regular slots. Add zerolen arg. + * lisp.h (allocate_pseudovector): Adjust prototype. + (ALLOCATE_PSEUDOVECTOR): Adjust user. + (ALLOCATE_ZEROED_PSEUDOVECTOR): New macro. + (allocate_hash_table, allocate_window, allocate_frame) + (allocate_process, allocate_terminal): Remove prototypes. + * fns.c (allocate_hash_table): Now static here. + * frame.c (allocate_frame): + * process.c (allocate_process): + * terminal.c (allocate_terminal): + * window.c (allocate_window): Now static here. + Use ALLOCATE_ZEROED_PSEUDOVECTOR. Add comment. + + * lisp.h (XTERMINAL): Add eassert. + * process.c (make_lisp_proc): Now static here. + + Prefer INLINE functions in font.h to match style used in lisp.h. + * font.h (FONTP, FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P) + (CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY, CHECK_FONT_OBJECT) + (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, CHECK_FONT_GET_OBJECT): + Now functions. + * font.c (Ffont_otf_alternates, Fquery_font, Ffont_get_glyphs): + * ftfont.c (ftfont_shape): + * macfont.m (macfont_shape): + * w32uniscribe.c (uniscribe_shape): + * xftfont.c (xftfont_shape): Adjust CHECK_FONT_GET_OBJECT users. + +2015-01-16 Paul Eggert <eggert@cs.ucla.edu> + + Give up on -Wsuggest-attribute=const + * decompress.c (Fzlib_available_p): + * gnutls.c (Fgnutls_available_p): + * gtkutil.h (xg_uses_old_file_dialog): + * xdisp.c (Ftool_bar_height): + * xmenu.c (popup_activated): + No longer const, since it's not const on at lest some + configurations, and we shouldn't lie to the compiler. + +2015-01-15 Eli Zaretskii <eliz@gnu.org> + + * fileio.c: Include binary-io.h. + (Fset_binary_mode): New function. + (syms_of_fileio): Defsubr it. + (syms_of_fileio) <Qstdin, Qstdout, Qstderr>: DEFSYM them. + +2015-01-15 Teodor Zlatanov <tzz@lifelogs.com> + + * gnutls.c (init_gnutls_functions): Import gnutls_x509_crt_check_issuer. + (Fgnutls_peer_status): Use it to set the :self-signed flag. + Rename the previous :self-signed to :unknown-ca. (Bug#19404) + (Fgnutls_peer_status_warning_describe): Explain :unknown-ca flag. + 2015-01-14 Eli Zaretskii <eliz@gnu.org> * w32fns.c (w32_wnd_proc): Ignore MENUITEMINFO's dwItemData data diff --git a/src/alloc.c b/src/alloc.c index 7c937332407..22a15b4ac59 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3163,19 +3163,19 @@ allocate_vector (EMACS_INT len) /* Allocate other vector-like structures. */ struct Lisp_Vector * -allocate_pseudovector (int memlen, int lisplen, enum pvec_type tag) +allocate_pseudovector (int memlen, int lisplen, + int zerolen, enum pvec_type tag) { struct Lisp_Vector *v = allocate_vectorlike (memlen); - int i; /* Catch bogus values. */ eassert (tag <= PVEC_FONT); eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); - /* Only the first lisplen slots will be traced normally by the GC. */ - for (i = 0; i < lisplen; ++i) - v->contents[i] = Qnil; + /* Only the first lisplen slots will be traced normally by the GC. + But since Qnil == 0, we can memset Lisp_Object slots as well. */ + memset (v->contents, 0, zerolen * word_size); XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); return v; @@ -3194,60 +3194,6 @@ allocate_buffer (void) return b; } -struct Lisp_Hash_Table * -allocate_hash_table (void) -{ - return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, count, PVEC_HASH_TABLE); -} - -struct window * -allocate_window (void) -{ - struct window *w; - - w = ALLOCATE_PSEUDOVECTOR (struct window, current_matrix, PVEC_WINDOW); - /* Users assumes that non-Lisp data is zeroed. */ - memset (&w->current_matrix, 0, - sizeof (*w) - offsetof (struct window, current_matrix)); - return w; -} - -struct terminal * -allocate_terminal (void) -{ - struct terminal *t; - - t = ALLOCATE_PSEUDOVECTOR (struct terminal, next_terminal, PVEC_TERMINAL); - /* Users assumes that non-Lisp data is zeroed. */ - memset (&t->next_terminal, 0, - sizeof (*t) - offsetof (struct terminal, next_terminal)); - return t; -} - -struct frame * -allocate_frame (void) -{ - struct frame *f; - - f = ALLOCATE_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME); - /* Users assumes that non-Lisp data is zeroed. */ - memset (&f->face_cache, 0, - sizeof (*f) - offsetof (struct frame, face_cache)); - return f; -} - -struct Lisp_Process * -allocate_process (void) -{ - struct Lisp_Process *p; - - p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); - /* Users assumes that non-Lisp data is zeroed. */ - memset (&p->pid, 0, - sizeof (*p) - offsetof (struct Lisp_Process, pid)); - return p; -} - DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, doc: /* Return a newly created vector of length LENGTH, with each element being INIT. See also the function `vector'. */) diff --git a/src/decompress.c b/src/decompress.c index b78dacee207..b14f0a2cd79 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -88,8 +88,7 @@ unwind_decompress (void *ddata) } DEFUN ("zlib-available-p", Fzlib_available_p, Szlib_available_p, 0, 0, 0, - doc: /* Return t if zlib decompression is available in this instance of Emacs. */ - attributes: const) + doc: /* Return t if zlib decompression is available in this instance of Emacs. */) (void) { #ifdef WINDOWSNT diff --git a/src/fileio.c b/src/fileio.c index 6c443c91db7..dc67a00ed2a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -86,6 +86,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <careadlinkat.h> #include <stat-time.h> +#include <binary-io.h> + #ifdef HPUX #include <netio.h> #endif @@ -5754,6 +5756,48 @@ before any other event (mouse or keypress) is handled. */) return Qnil; } + +DEFUN ("set-binary-mode", Fset_binary_mode, Sset_binary_mode, 2, 2, 0, + doc: /* Switch STREAM to binary I/O mode or text I/O mode. +STREAM can be one of the symbols `stdin', `stdout', or `stderr'. +If MODE is non-nil, switch STREAM to binary mode, otherwise switch +it to text mode. + +As a side effect, this function flushes any pending STREAM's data. + +Value is the previous value of STREAM's I/O mode, nil for text mode, +non-nil for binary mode. + +On MS-Windows and MS-DOS, binary mode is needed to read or write +arbitrary binary data, and for disabling translation between CR-LF +pairs and a single newline character. Examples include generation +of text files with Unix-style end-of-line format using `princ' in +batch mode, with standard output redirected to a file. + +On Posix systems, this function always returns non-nil, and has no +effect except for flushing STREAM's data. */) + (Lisp_Object stream, Lisp_Object mode) +{ + FILE *fp = NULL; + int binmode; + + CHECK_SYMBOL (stream); + if (EQ (stream, Qstdin)) + fp = stdin; + else if (EQ (stream, Qstdout)) + fp = stdout; + else if (EQ (stream, Qstderr)) + fp = stderr; + else + xsignal2 (Qerror, build_string ("unsupported stream"), stream); + + binmode = NILP (mode) ? O_TEXT : O_BINARY; + if (fp != stdin) + fflush (fp); + + return (set_binary_mode (fileno (fp), binmode) == O_BINARY) ? Qt : Qnil; +} + void init_fileio (void) { @@ -6040,6 +6084,10 @@ This includes interactive calls to `delete-file' and DEFSYM (Qsubstitute_env_in_file_name, "substitute-env-in-file-name"); DEFSYM (Qget_buffer_window_list, "get-buffer-window-list"); + DEFSYM (Qstdin, "stdin"); + DEFSYM (Qstdout, "stdout"); + DEFSYM (Qstderr, "stderr"); + defsubr (&Sfind_file_name_handler); defsubr (&Sfile_name_directory); defsubr (&Sfile_name_nondirectory); @@ -6089,6 +6137,8 @@ This includes interactive calls to `delete-file' and defsubr (&Snext_read_file_uses_dialog_p); + defsubr (&Sset_binary_mode); + #ifdef HAVE_SYNC defsubr (&Sunix_sync); #endif diff --git a/src/fns.c b/src/fns.c index 91cd5132546..ca3d98b23dd 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3814,6 +3814,15 @@ hashfn_user_defined (struct hash_table_test *ht, Lisp_Object key) return hashfn_eq (ht, hash); } +/* Allocate basically initialized hash table. */ + +static struct Lisp_Hash_Table * +allocate_hash_table (void) +{ + return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, + count, PVEC_HASH_TABLE); +} + /* An upper bound on the size of a hash table index. It must fit in ptrdiff_t and be a valid Emacs fixnum. */ #define INDEX_SIZE_BOUND \ diff --git a/src/font.c b/src/font.c index a68c3c707c8..56a27821718 100644 --- a/src/font.c +++ b/src/font.c @@ -156,7 +156,7 @@ font_make_spec (void) struct font_spec *spec = ((struct font_spec *) allocate_pseudovector (VECSIZE (struct font_spec), - FONT_SPEC_MAX, PVEC_FONT)); + FONT_SPEC_MAX, FONT_SPEC_MAX, PVEC_FONT)); XSETFONT (font_spec, spec); return font_spec; } @@ -168,7 +168,7 @@ font_make_entity (void) struct font_entity *entity = ((struct font_entity *) allocate_pseudovector (VECSIZE (struct font_entity), - FONT_ENTITY_MAX, PVEC_FONT)); + FONT_ENTITY_MAX, FONT_ENTITY_MAX, PVEC_FONT)); XSETFONT (font_entity, entity); return font_entity; } @@ -181,7 +181,8 @@ font_make_object (int size, Lisp_Object entity, int pixelsize) { Lisp_Object font_object; struct font *font - = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); + = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, + FONT_OBJECT_MAX, PVEC_FONT); int i; /* GC can happen before the driver is set up, @@ -4532,12 +4533,11 @@ character code corresponding to the glyph or nil if there's no corresponding character. */) (Lisp_Object font_object, Lisp_Object character, Lisp_Object otf_features) { - struct font *font; + struct font *font = CHECK_FONT_GET_OBJECT (font_object); Lisp_Object gstring_in, gstring_out, g; Lisp_Object alternates; int i, num; - CHECK_FONT_GET_OBJECT (font_object, font); if (! font->driver->otf_drive) error ("Font backend %s can't drive OpenType GSUB table", SDATA (SYMBOL_NAME (font->driver->type))); @@ -4647,12 +4647,9 @@ FEATURE is a symbol representing OpenType feature tag. If the font is not OpenType font, CAPABILITY is nil. */) (Lisp_Object font_object) { - struct font *font; - Lisp_Object val; + struct font *font = CHECK_FONT_GET_OBJECT (font_object); + Lisp_Object val = make_uninit_vector (9); - CHECK_FONT_GET_OBJECT (font_object, font); - - val = make_uninit_vector (9); ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); ASET (val, 2, make_number (font->pixel_size)); @@ -4691,12 +4688,11 @@ the corresponding element is nil. */) (Lisp_Object font_object, Lisp_Object from, Lisp_Object to, Lisp_Object object) { - struct font *font; + struct font *font = CHECK_FONT_GET_OBJECT (font_object); ptrdiff_t i, len; Lisp_Object *chars, vec; USE_SAFE_ALLOCA; - CHECK_FONT_GET_OBJECT (font_object, font); if (NILP (object)) { ptrdiff_t charpos, bytepos; diff --git a/src/font.h b/src/font.h index 5a3e38a2a6e..efc184eef77 100644 --- a/src/font.h +++ b/src/font.h @@ -413,46 +413,91 @@ struct font_bitmap /* Predicates to check various font-related objects. */ /* True iff X is one of font-spec, font-entity, and font-object. */ -#define FONTP(x) PSEUDOVECTORP (x, PVEC_FONT) +INLINE bool +FONTP (Lisp_Object x) +{ + return PSEUDOVECTORP (x, PVEC_FONT); +} + /* True iff X is font-spec. */ -#define FONT_SPEC_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX) +INLINE bool +FONT_SPEC_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; +} + /* True iff X is font-entity. */ -#define FONT_ENTITY_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX) +INLINE bool +FONT_ENTITY_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; +} + /* True iff X is font-object. */ -#define FONT_OBJECT_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) - -/* Check macros for various font-related objects. */ - -#define CHECK_FONT(x) \ - do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (false) -#define CHECK_FONT_SPEC(x) \ - do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } \ - while (false) -#define CHECK_FONT_ENTITY(x) \ - do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } \ - while (false) -#define CHECK_FONT_OBJECT(x) \ - do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } \ - while (false) - -#define CHECK_FONT_GET_OBJECT(x, font) \ - do { \ - CHECK_FONT_OBJECT (x); \ - font = XFONT_OBJECT (x); \ - } while (false) +INLINE bool +FONT_OBJECT_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; +} + +/* Type checking functions for various font-related objects. */ + +INLINE void +CHECK_FONT (Lisp_Object x) +{ + CHECK_TYPE (FONTP (x), Qfont, x); +} + +INLINE void +CHECK_FONT_SPEC (Lisp_Object x) +{ + CHECK_TYPE (FONT_SPEC_P (x), Qfont_spec, x); +} + +INLINE void +CHECK_FONT_ENTITY (Lisp_Object x) +{ + CHECK_TYPE (FONT_ENTITY_P (x), Qfont_entity, x); +} + +INLINE void +CHECK_FONT_OBJECT (Lisp_Object x) +{ + CHECK_TYPE (FONT_OBJECT_P (x), Qfont_object, x); +} + +/* C pointer extraction functions for various font-related objects. */ + +INLINE struct font_spec * +XFONT_SPEC (Lisp_Object p) +{ + eassert (FONT_SPEC_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font_entity * +XFONT_ENTITY (Lisp_Object p) +{ + eassert (FONT_ENTITY_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font * +XFONT_OBJECT (Lisp_Object p) +{ + eassert (FONT_OBJECT_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} -#define XFONT_SPEC(p) \ - (eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_ENTITY(p) \ - (eassert (FONT_ENTITY_P (p)), \ - (struct font_entity *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_OBJECT(p) \ - (eassert (FONT_OBJECT_P (p)), (struct font *) XUNTAG (p, Lisp_Vectorlike)) #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) +INLINE struct font * +CHECK_FONT_GET_OBJECT (Lisp_Object x) +{ + CHECK_FONT_OBJECT (x); + return XFONT_OBJECT (x); +} + /* Number of pt per inch (from the TeXbook). */ #define PT_PER_INCH 72.27 diff --git a/src/frame.c b/src/frame.c index ec580f37c5b..2ce5a623853 100644 --- a/src/frame.c +++ b/src/frame.c @@ -570,6 +570,13 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, run_window_configuration_change_hook (f); } +/* Allocate basically initialized frame. */ + +static struct frame * +allocate_frame (void) +{ + return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME); +} struct frame * make_frame (bool mini_p) diff --git a/src/ftfont.c b/src/ftfont.c index 9707b6c1b71..053b95fc69f 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2576,13 +2576,10 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, Lisp_Object ftfont_shape (Lisp_Object lgstring) { - struct font *font; - struct ftfont_info *ftfont_info; - OTF *otf; + struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring)); + struct ftfont_info *ftfont_info = (struct ftfont_info *) font; + OTF *otf = ftfont_get_otf (ftfont_info); - CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); - ftfont_info = (struct ftfont_info *) font; - otf = ftfont_get_otf (ftfont_info); if (! otf) return make_number (0); return ftfont_shape_by_flt (lgstring, font, ftfont_info->ft_size->face, otf, diff --git a/src/gnutls.c b/src/gnutls.c index 5e6c6353b45..35f0eb48bc1 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -122,6 +122,8 @@ DEF_DLL_FN (void, gnutls_transport_set_push_function, (gnutls_session_t, gnutls_push_func)); DEF_DLL_FN (int, gnutls_x509_crt_check_hostname, (gnutls_x509_crt_t, const char *)); +DEF_DLL_FN (int, gnutls_x509_crt_check_issuer, + (gnutls_x509_crt_t, gnutls_x509_crt_t)); DEF_DLL_FN (void, gnutls_x509_crt_deinit, (gnutls_x509_crt_t)); DEF_DLL_FN (int, gnutls_x509_crt_import, (gnutls_x509_crt_t, const gnutls_datum_t *, @@ -236,6 +238,7 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_transport_set_pull_function); LOAD_DLL_FN (library, gnutls_transport_set_push_function); LOAD_DLL_FN (library, gnutls_x509_crt_check_hostname); + LOAD_DLL_FN (library, gnutls_x509_crt_check_issuer); LOAD_DLL_FN (library, gnutls_x509_crt_deinit); LOAD_DLL_FN (library, gnutls_x509_crt_import); LOAD_DLL_FN (library, gnutls_x509_crt_init); @@ -329,6 +332,7 @@ init_gnutls_functions (void) # define gnutls_transport_set_pull_function fn_gnutls_transport_set_pull_function # define gnutls_transport_set_push_function fn_gnutls_transport_set_push_function # define gnutls_x509_crt_check_hostname fn_gnutls_x509_crt_check_hostname +# define gnutls_x509_crt_check_issuer fn_gnutls_x509_crt_check_issuer # define gnutls_x509_crt_deinit fn_gnutls_x509_crt_deinit # define gnutls_x509_crt_get_activation_time fn_gnutls_x509_crt_get_activation_time # define gnutls_x509_crt_get_dn fn_gnutls_x509_crt_get_dn @@ -982,6 +986,10 @@ DEFUN ("gnutls-peer-status-warning-describe", Fgnutls_peer_status_warning_descri if (EQ (status_symbol, intern (":self-signed"))) return build_string ("certificate signer was not found (self-signed)"); + if (EQ (status_symbol, intern (":unknown-ca"))) + return build_string ("the certificate was signed by an unknown " + "and therefore untrusted authority"); + if (EQ (status_symbol, intern (":not-ca"))) return build_string ("certificate signer is not a CA"); @@ -1026,7 +1034,7 @@ The return value is a property list with top-level keys :warnings and warnings = Fcons (intern (":revoked"), warnings); if (verification & GNUTLS_CERT_SIGNER_NOT_FOUND) - warnings = Fcons (intern (":self-signed"), warnings); + warnings = Fcons (intern (":unknown-ca"), warnings); if (verification & GNUTLS_CERT_SIGNER_NOT_CA) warnings = Fcons (intern (":not-ca"), warnings); @@ -1044,6 +1052,13 @@ The return value is a property list with top-level keys :warnings and CERTIFICATE_NOT_MATCHING) warnings = Fcons (intern (":no-host-match"), warnings); + /* This could get called in the INIT stage, when the certificate is + not yet set. */ + if (XPROCESS (proc)->gnutls_certificate != NULL && + gnutls_x509_crt_check_issuer(XPROCESS (proc)->gnutls_certificate, + XPROCESS (proc)->gnutls_certificate)) + warnings = Fcons (intern (":self-signed"), warnings); + if (!NILP (warnings)) result = list2 (intern (":warnings"), warnings); @@ -1604,8 +1619,7 @@ This function may also return `gnutls-e-again', or #endif /* HAVE_GNUTLS */ DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, - doc: /* Return t if GnuTLS is available in this instance of Emacs. */ - attributes: const) + doc: /* Return t if GnuTLS is available in this instance of Emacs. */) (void) { #ifdef HAVE_GNUTLS diff --git a/src/gtkutil.h b/src/gtkutil.h index 7d712c92e0d..0ac49ca7db5 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -78,7 +78,7 @@ typedef struct xg_menu_item_cb_data_ } xg_menu_item_cb_data; -extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; +extern bool xg_uses_old_file_dialog (void); extern char *xg_get_file_name (struct frame *f, char *prompt, diff --git a/src/lisp.h b/src/lisp.h index b6608daa20e..e94e39a5d01 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -608,6 +608,7 @@ INLINE bool SUBRP (Lisp_Object); INLINE bool (SYMBOLP) (Lisp_Object); INLINE bool (VECTORLIKEP) (Lisp_Object); INLINE bool WINDOWP (Lisp_Object); +INLINE bool TERMINALP (Lisp_Object); INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); INLINE struct Lisp_Symbol *(XSYMBOL) (Lisp_Object); INLINE void *(XUNTAG) (Lisp_Object, int); @@ -1003,6 +1004,7 @@ XWINDOW (Lisp_Object a) INLINE struct terminal * XTERMINAL (Lisp_Object a) { + eassert (TERMINALP (a)); return XUNTAG (a, Lisp_Vectorlike); } @@ -1065,12 +1067,6 @@ builtin_lisp_symbol (int index) return make_lisp_symbol (lispsym + index); } -INLINE Lisp_Object -make_lisp_proc (struct Lisp_Process *p) -{ - return make_lisp_ptr (p, Lisp_Vectorlike); -} - #define XSETINT(a, b) ((a) = make_number (b)) #define XSETFASTINT(a, b) ((a) = make_natnum (b)) #define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Lisp_Cons)) @@ -3785,16 +3781,25 @@ make_uninit_sub_char_table (int depth, int min_char) return v; } -extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); -#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ - ((typ*) \ - allocate_pseudovector \ - (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag)) -extern struct Lisp_Hash_Table *allocate_hash_table (void); -extern struct window *allocate_window (void); -extern struct frame *allocate_frame (void); -extern struct Lisp_Process *allocate_process (void); -extern struct terminal *allocate_terminal (void); +extern struct Lisp_Vector *allocate_pseudovector (int, int, int, + enum pvec_type); + +/* Allocate partially initialized pseudovector where all Lisp_Object + slots are set to Qnil but the rest (if any) is left uninitialized. */ + +#define ALLOCATE_PSEUDOVECTOR(type, field, tag) \ + ((type *) allocate_pseudovector (VECSIZE (type), \ + PSEUDOVECSIZE (type, field), \ + PSEUDOVECSIZE (type, field), tag)) + +/* Allocate fully initialized pseudovector where all Lisp_Object + slots are set to Qnil and the rest (if any) is zeroed. */ + +#define ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, tag) \ + ((type *) allocate_pseudovector (VECSIZE (type), \ + PSEUDOVECSIZE (type, field), \ + VECSIZE (type), tag)) + extern bool gc_in_progress; extern bool abort_on_gc; extern Lisp_Object make_float (double); diff --git a/src/macfont.m b/src/macfont.m index f569934128f..cbf1b07bc94 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2788,9 +2788,9 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, static Lisp_Object macfont_shape (Lisp_Object lgstring) { - struct font *font; - struct macfont_info *macfont_info; - FontRef macfont; + struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring)); + struct macfont_info *macfont_info = (struct macfont_info *) font; + FontRef macfont = macfont_info->macfont; ptrdiff_t glyph_len, len, i, j; CFIndex nonbmp_len; UniChar *unichars; @@ -2799,10 +2799,6 @@ macfont_shape (Lisp_Object lgstring) CFIndex used = 0; struct mac_glyph_layout *glyph_layouts; - CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); - macfont_info = (struct macfont_info *) font; - macfont = macfont_info->macfont; - glyph_len = LGSTRING_GLYPH_LEN (lgstring); nonbmp_len = 0; for (i = 0; i < glyph_len; i++) diff --git a/src/process.c b/src/process.c index 77c94f29211..0789f20f1d2 100644 --- a/src/process.c +++ b/src/process.c @@ -422,6 +422,11 @@ pset_write_queue (struct Lisp_Process *p, Lisp_Object val) } +static Lisp_Object +make_lisp_proc (struct Lisp_Process *p) +{ + return make_lisp_ptr (p, Lisp_Vectorlike); +} static struct fd_callback_data { @@ -687,7 +692,15 @@ allocate_pty (char pty_name[PTY_NAME_SIZE]) #endif /* HAVE_PTYS */ return -1; } - + +/* Allocate basically initialized process. */ + +static struct Lisp_Process * +allocate_process (void) +{ + return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); +} + static Lisp_Object make_process (Lisp_Object name) { diff --git a/src/terminal.c b/src/terminal.c index 92befd28543..b48d0623e12 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -254,6 +254,15 @@ get_named_terminal (const char *name) return NULL; } +/* Allocate basically initialized terminal. */ + +static struct terminal * +allocate_terminal (void) +{ + return ALLOCATE_ZEROED_PSEUDOVECTOR + (struct terminal, next_terminal, PVEC_TERMINAL); +} + /* Create a new terminal object of TYPE and add it to the terminal list. RIF may be NULL if this terminal type doesn't support window-based redisplay. */ diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 2a7fe2e6f91..9cd97e28616 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -183,8 +183,9 @@ uniscribe_otf_capability (struct font *font) static Lisp_Object uniscribe_shape (Lisp_Object lgstring) { - struct font * font; - struct uniscribe_font_info * uniscribe_font; + struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring)); + struct uniscribe_font_info *uniscribe_font + = (struct uniscribe_font_info *) font; EMACS_UINT nchars; int nitems, max_items, i, max_glyphs, done_glyphs; wchar_t *chars; @@ -199,9 +200,6 @@ uniscribe_shape (Lisp_Object lgstring) HDC context = NULL; HFONT old_font = NULL; - CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); - uniscribe_font = (struct uniscribe_font_info *) font; - /* Get the chars from lgstring in a form we can use with uniscribe. */ max_glyphs = nchars = LGSTRING_GLYPH_LEN (lgstring); done_glyphs = 0; diff --git a/src/window.c b/src/window.c index 60ba3750f5b..d14a0f74fa0 100644 --- a/src/window.c +++ b/src/window.c @@ -3645,7 +3645,16 @@ temp_output_buffer_show (register Lisp_Object buf) } } } - + +/* Allocate basically initialized window. */ + +static struct window * +allocate_window (void) +{ + return ALLOCATE_ZEROED_PSEUDOVECTOR + (struct window, current_matrix, PVEC_WINDOW); +} + /* Make new window, have it replace WINDOW in window-tree, and make WINDOW its only vertical child (HORFLAG 1 means make WINDOW its only horizontal child). */ diff --git a/src/xdisp.c b/src/xdisp.c index a37575778e8..b38e8a64c5d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12332,8 +12332,7 @@ DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height, 0, 2, 0, doc: /* Return the number of lines occupied by the tool bar of FRAME. If FRAME is nil or omitted, use the selected frame. Optional argument -PIXELWISE non-nil means return the height of the tool bar in pixels. */ - attributes: const) +PIXELWISE non-nil means return the height of the tool bar in pixels. */) (Lisp_Object frame, Lisp_Object pixelwise) { int height = 0; diff --git a/src/xftfont.c b/src/xftfont.c index c587d814efa..054b38e120f 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -640,13 +640,11 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, static Lisp_Object xftfont_shape (Lisp_Object lgstring) { - struct font *font; - struct xftfont_info *xftfont_info; + struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring)); + struct xftfont_info *xftfont_info = (struct xftfont_info *) font; FT_Face ft_face; Lisp_Object val; - CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); - xftfont_info = (struct xftfont_info *) font; ft_face = XftLockFace (xftfont_info->xftfont); xftfont_info->ft_size = ft_face->size; val = ftfont_driver.shape (lgstring); diff --git a/src/xmenu.c b/src/xmenu.c index 9063a8a2a52..fdf1f6f4d84 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -2288,7 +2288,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, /* Detect if a dialog or menu has been posted. MSDOS has its own implementation on msdos.c. */ -int ATTRIBUTE_CONST +int popup_activated (void) { return popup_activated_flag; |