diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 16 | ||||
| -rw-r--r-- | src/lread.c | 17 | ||||
| -rw-r--r-- | src/pgtkterm.c | 7 | ||||
| -rw-r--r-- | src/sqlite.c | 82 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
5 files changed, 97 insertions, 29 deletions
| @@ -3213,16 +3213,21 @@ If the `use-short-answers' variable is non-nil, instead of asking for | |||
| 3213 | \"yes\" or \"no\", this function will ask for \"y\" or \"n\" (and | 3213 | \"yes\" or \"no\", this function will ask for \"y\" or \"n\" (and |
| 3214 | ignore the value of `yes-or-no-prompt'). | 3214 | ignore the value of `yes-or-no-prompt'). |
| 3215 | 3215 | ||
| 3216 | If dialog boxes are supported, a dialog box will be used | 3216 | If dialog boxes are supported, this function will use a dialog box |
| 3217 | if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) | 3217 | if `use-dialog-box' is non-nil and the last input event was produced |
| 3218 | by a mouse, or by some window-system gesture, or via a menu. */) | ||
| 3218 | (Lisp_Object prompt) | 3219 | (Lisp_Object prompt) |
| 3219 | { | 3220 | { |
| 3220 | Lisp_Object ans; | 3221 | Lisp_Object ans, val; |
| 3221 | 3222 | ||
| 3222 | CHECK_STRING (prompt); | 3223 | CHECK_STRING (prompt); |
| 3223 | 3224 | ||
| 3224 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 3225 | if (!NILP (last_input_event) |
| 3225 | && use_dialog_box && ! NILP (last_input_event)) | 3226 | && (CONSP (last_nonmenu_event) |
| 3227 | || (NILP (last_nonmenu_event) && CONSP (last_input_event)) | ||
| 3228 | || (val = find_symbol_value (Qfrom__tty_menu_p), | ||
| 3229 | (!NILP (val) && !EQ (val, Qunbound)))) | ||
| 3230 | && use_dialog_box) | ||
| 3226 | { | 3231 | { |
| 3227 | Lisp_Object pane, menu, obj; | 3232 | Lisp_Object pane, menu, obj; |
| 3228 | redisplay_preserve_echo_area (4); | 3233 | redisplay_preserve_echo_area (4); |
| @@ -6401,4 +6406,5 @@ For best results this should end in a space. */); | |||
| 6401 | defsubr (&Sbuffer_line_statistics); | 6406 | defsubr (&Sbuffer_line_statistics); |
| 6402 | 6407 | ||
| 6403 | DEFSYM (Qreal_this_command, "real-this-command"); | 6408 | DEFSYM (Qreal_this_command, "real-this-command"); |
| 6409 | DEFSYM (Qfrom__tty_menu_p, "from--tty-menu-p"); | ||
| 6404 | } | 6410 | } |
diff --git a/src/lread.c b/src/lread.c index 3ac5d43a839..43fa23003ca 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3646,8 +3646,9 @@ read_bool_vector (Lisp_Object readcharfun) | |||
| 3646 | } | 3646 | } |
| 3647 | 3647 | ||
| 3648 | /* Skip (and optionally remember) a lazily-loaded string | 3648 | /* Skip (and optionally remember) a lazily-loaded string |
| 3649 | preceded by "#@". */ | 3649 | preceded by "#@". Return true if this was a normal skip, |
| 3650 | static void | 3650 | false if we read #@00 (which skips to EOB). */ |
| 3651 | static bool | ||
| 3651 | skip_lazy_string (Lisp_Object readcharfun) | 3652 | skip_lazy_string (Lisp_Object readcharfun) |
| 3652 | { | 3653 | { |
| 3653 | ptrdiff_t nskip = 0; | 3654 | ptrdiff_t nskip = 0; |
| @@ -3673,9 +3674,9 @@ skip_lazy_string (Lisp_Object readcharfun) | |||
| 3673 | digits++; | 3674 | digits++; |
| 3674 | if (digits == 2 && nskip == 0) | 3675 | if (digits == 2 && nskip == 0) |
| 3675 | { | 3676 | { |
| 3676 | /* #@00 means "skip to end" */ | 3677 | /* #@00 means "read nil and skip to end" */ |
| 3677 | skip_dyn_eof (readcharfun); | 3678 | skip_dyn_eof (readcharfun); |
| 3678 | return; | 3679 | return false; |
| 3679 | } | 3680 | } |
| 3680 | } | 3681 | } |
| 3681 | 3682 | ||
| @@ -3722,6 +3723,8 @@ skip_lazy_string (Lisp_Object readcharfun) | |||
| 3722 | else | 3723 | else |
| 3723 | /* Skip that many bytes. */ | 3724 | /* Skip that many bytes. */ |
| 3724 | skip_dyn_bytes (readcharfun, nskip); | 3725 | skip_dyn_bytes (readcharfun, nskip); |
| 3726 | |||
| 3727 | return true; | ||
| 3725 | } | 3728 | } |
| 3726 | 3729 | ||
| 3727 | /* Given a lazy-loaded string designator VAL, return the actual string. | 3730 | /* Given a lazy-loaded string designator VAL, return the actual string. |
| @@ -4179,8 +4182,10 @@ read0 (Lisp_Object readcharfun, bool locate_syms) | |||
| 4179 | /* #@NUMBER is used to skip NUMBER following bytes. | 4182 | /* #@NUMBER is used to skip NUMBER following bytes. |
| 4180 | That's used in .elc files to skip over doc strings | 4183 | That's used in .elc files to skip over doc strings |
| 4181 | and function definitions that can be loaded lazily. */ | 4184 | and function definitions that can be loaded lazily. */ |
| 4182 | skip_lazy_string (readcharfun); | 4185 | if (skip_lazy_string (readcharfun)) |
| 4183 | goto read_obj; | 4186 | goto read_obj; |
| 4187 | obj = Qnil; /* #@00 skips to EOB and yields nil. */ | ||
| 4188 | break; | ||
| 4184 | 4189 | ||
| 4185 | case '$': | 4190 | case '$': |
| 4186 | /* #$ -- reference to lazy-loaded string */ | 4191 | /* #$ -- reference to lazy-loaded string */ |
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index b8c626d81d8..91e4d828f51 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -376,6 +376,13 @@ mark_pgtkterm (void) | |||
| 376 | for (i = 0; i < n; i++) | 376 | for (i = 0; i < n; i++) |
| 377 | { | 377 | { |
| 378 | union buffered_input_event *ev = &evq->q[i]; | 378 | union buffered_input_event *ev = &evq->q[i]; |
| 379 | |||
| 380 | /* Selection requests don't have Lisp object members. */ | ||
| 381 | |||
| 382 | if (ev->ie.kind == SELECTION_REQUEST_EVENT | ||
| 383 | || ev->ie.kind == SELECTION_CLEAR_EVENT) | ||
| 384 | continue; | ||
| 385 | |||
| 379 | mark_object (ev->ie.x); | 386 | mark_object (ev->ie.x); |
| 380 | mark_object (ev->ie.y); | 387 | mark_object (ev->ie.y); |
| 381 | mark_object (ev->ie.frame_or_window); | 388 | mark_object (ev->ie.frame_or_window); |
diff --git a/src/sqlite.c b/src/sqlite.c index 0361514766a..fd528f2b0d5 100644 --- a/src/sqlite.c +++ b/src/sqlite.c | |||
| @@ -23,6 +23,8 @@ YOSHIDA <syohex@gmail.com>, which can be found at: | |||
| 23 | https://github.com/syohex/emacs-sqlite3 */ | 23 | https://github.com/syohex/emacs-sqlite3 */ |
| 24 | 24 | ||
| 25 | #include <config.h> | 25 | #include <config.h> |
| 26 | |||
| 27 | #include <c-strcase.h> | ||
| 26 | #include "lisp.h" | 28 | #include "lisp.h" |
| 27 | #include "coding.h" | 29 | #include "coding.h" |
| 28 | 30 | ||
| @@ -30,6 +32,17 @@ YOSHIDA <syohex@gmail.com>, which can be found at: | |||
| 30 | 32 | ||
| 31 | #include <sqlite3.h> | 33 | #include <sqlite3.h> |
| 32 | 34 | ||
| 35 | /* Support for loading SQLite extensions requires the ability to | ||
| 36 | enable and disable loading of extensions (by default this is | ||
| 37 | disabled, and we want to keep it that way). The required macro is | ||
| 38 | available since SQLite 3.13. */ | ||
| 39 | # if defined HAVE_SQLITE3_LOAD_EXTENSION && \ | ||
| 40 | defined SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION | ||
| 41 | # define HAVE_LOAD_EXTENSION 1 | ||
| 42 | # else | ||
| 43 | # define HAVE_LOAD_EXTENSION 0 | ||
| 44 | # endif | ||
| 45 | |||
| 33 | #ifdef WINDOWSNT | 46 | #ifdef WINDOWSNT |
| 34 | 47 | ||
| 35 | # include <windows.h> | 48 | # include <windows.h> |
| @@ -75,11 +88,14 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_exec, | |||
| 75 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, | 88 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, |
| 76 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); | 89 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); |
| 77 | 90 | ||
| 78 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | 91 | # if HAVE_LOAD_EXTENSION |
| 79 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, | 92 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, |
| 80 | (sqlite3*, const char*, const char*, char**)); | 93 | (sqlite3*, const char*, const char*, char**)); |
| 81 | # undef sqlite3_load_extension | 94 | # undef sqlite3_load_extension |
| 82 | # define sqlite3_load_extension fn_sqlite3_load_extension | 95 | # define sqlite3_load_extension fn_sqlite3_load_extension |
| 96 | DEF_DLL_FN (SQLITE_API int, sqlite3_db_config, (sqlite3*, int, ...)); | ||
| 97 | # undef sqlite3_db_config | ||
| 98 | # define sqlite3_db_config fn_sqlite3_db_config | ||
| 83 | # endif | 99 | # endif |
| 84 | 100 | ||
| 85 | # undef sqlite3_finalize | 101 | # undef sqlite3_finalize |
| @@ -170,8 +186,9 @@ load_dll_functions (HMODULE library) | |||
| 170 | LOAD_DLL_FN (library, sqlite3_column_text); | 186 | LOAD_DLL_FN (library, sqlite3_column_text); |
| 171 | LOAD_DLL_FN (library, sqlite3_column_name); | 187 | LOAD_DLL_FN (library, sqlite3_column_name); |
| 172 | LOAD_DLL_FN (library, sqlite3_exec); | 188 | LOAD_DLL_FN (library, sqlite3_exec); |
| 173 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | 189 | # if HAVE_LOAD_EXTENSION |
| 174 | LOAD_DLL_FN (library, sqlite3_load_extension); | 190 | LOAD_DLL_FN (library, sqlite3_load_extension); |
| 191 | LOAD_DLL_FN (library, sqlite3_db_config); | ||
| 175 | # endif | 192 | # endif |
| 176 | LOAD_DLL_FN (library, sqlite3_prepare_v2); | 193 | LOAD_DLL_FN (library, sqlite3_prepare_v2); |
| 177 | return true; | 194 | return true; |
| @@ -669,7 +686,7 @@ DEFUN ("sqlite-pragma", Fsqlite_pragma, Ssqlite_pragma, 2, 2, 0, | |||
| 669 | SSDATA (concat2 (build_string ("PRAGMA "), pragma))); | 686 | SSDATA (concat2 (build_string ("PRAGMA "), pragma))); |
| 670 | } | 687 | } |
| 671 | 688 | ||
| 672 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | 689 | #if HAVE_LOAD_EXTENSION |
| 673 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, | 690 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, |
| 674 | Ssqlite_load_extension, 2, 2, 0, | 691 | Ssqlite_load_extension, 2, 2, 0, |
| 675 | doc: /* Load an SQlite MODULE into DB. | 692 | doc: /* Load an SQlite MODULE into DB. |
| @@ -684,9 +701,28 @@ Only modules on Emacs' list of allowed modules can be loaded. */) | |||
| 684 | CHECK_STRING (module); | 701 | CHECK_STRING (module); |
| 685 | 702 | ||
| 686 | /* Add names of useful and free modules here. */ | 703 | /* Add names of useful and free modules here. */ |
| 687 | const char *allowlist[3] = { "pcre", "csvtable", NULL }; | 704 | const char *allowlist[] = { |
| 705 | "base64", | ||
| 706 | "cksumvfs", | ||
| 707 | "compress", | ||
| 708 | "csv", | ||
| 709 | "csvtable", | ||
| 710 | "fts3", | ||
| 711 | "icu", | ||
| 712 | "pcre", | ||
| 713 | "percentile", | ||
| 714 | "regexp", | ||
| 715 | "rot13", | ||
| 716 | "rtree", | ||
| 717 | "sha1", | ||
| 718 | "uuid", | ||
| 719 | "vfslog", | ||
| 720 | "zipfile", | ||
| 721 | NULL | ||
| 722 | }; | ||
| 688 | char *name = SSDATA (Ffile_name_nondirectory (module)); | 723 | char *name = SSDATA (Ffile_name_nondirectory (module)); |
| 689 | /* Possibly skip past a common prefix. */ | 724 | /* Possibly skip past a common prefix (libsqlite3_mod_ is used by |
| 725 | Debian, see https://packages.debian.org/source/sid/sqliteodbc). */ | ||
| 690 | const char *prefix = "libsqlite3_mod_"; | 726 | const char *prefix = "libsqlite3_mod_"; |
| 691 | if (!strncmp (name, prefix, strlen (prefix))) | 727 | if (!strncmp (name, prefix, strlen (prefix))) |
| 692 | name += strlen (prefix); | 728 | name += strlen (prefix); |
| @@ -694,10 +730,12 @@ Only modules on Emacs' list of allowed modules can be loaded. */) | |||
| 694 | bool do_allow = false; | 730 | bool do_allow = false; |
| 695 | for (const char **allow = allowlist; *allow; allow++) | 731 | for (const char **allow = allowlist; *allow; allow++) |
| 696 | { | 732 | { |
| 697 | if (strlen (*allow) < strlen (name) | 733 | ptrdiff_t allow_len = strlen (*allow); |
| 698 | && !strncmp (*allow, name, strlen (*allow)) | 734 | if (allow_len < strlen (name) |
| 699 | && (!strcmp (name + strlen (*allow), ".so") | 735 | && !strncmp (*allow, name, allow_len) |
| 700 | || !strcmp (name + strlen (*allow), ".DLL"))) | 736 | && (!strcmp (name + allow_len, ".so") |
| 737 | ||!strcmp (name + allow_len, ".dylib") | ||
| 738 | || !strcasecmp (name + allow_len, ".dll"))) | ||
| 701 | { | 739 | { |
| 702 | do_allow = true; | 740 | do_allow = true; |
| 703 | break; | 741 | break; |
| @@ -707,15 +745,25 @@ Only modules on Emacs' list of allowed modules can be loaded. */) | |||
| 707 | if (!do_allow) | 745 | if (!do_allow) |
| 708 | xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist")); | 746 | xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist")); |
| 709 | 747 | ||
| 710 | int result = sqlite3_load_extension | 748 | /* Expand all Lisp data explicitly, so as to avoid signaling an |
| 711 | (XSQLITE (db)->db, | 749 | error while extension loading is enabled -- we don't want to |
| 712 | SSDATA (ENCODE_FILE (Fexpand_file_name (module, Qnil))), | 750 | "leak" this outside this function. */ |
| 713 | NULL, NULL); | 751 | sqlite3 *sdb = XSQLITE (db)->db; |
| 714 | if (result == SQLITE_OK) | 752 | char *ext_fn = SSDATA (ENCODE_FILE (Fexpand_file_name (module, Qnil))); |
| 715 | return Qt; | 753 | /* Temporarily enable loading extensions via the C API. */ |
| 754 | int result = sqlite3_db_config (sdb, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, | ||
| 755 | NULL); | ||
| 756 | if (result == SQLITE_OK) | ||
| 757 | { | ||
| 758 | result = sqlite3_load_extension (sdb, ext_fn, NULL, NULL); | ||
| 759 | /* Disable loading extensions via C API. */ | ||
| 760 | sqlite3_db_config (sdb, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 0, NULL); | ||
| 761 | if (result == SQLITE_OK) | ||
| 762 | return Qt; | ||
| 763 | } | ||
| 716 | return Qnil; | 764 | return Qnil; |
| 717 | } | 765 | } |
| 718 | #endif /* HAVE_SQLITE3_LOAD_EXTENSION */ | 766 | #endif /* HAVE_LOAD_EXTENSION */ |
| 719 | 767 | ||
| 720 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, | 768 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, |
| 721 | doc: /* Return the next result set from SET. | 769 | doc: /* Return the next result set from SET. |
| @@ -825,7 +873,7 @@ syms_of_sqlite (void) | |||
| 825 | defsubr (&Ssqlite_commit); | 873 | defsubr (&Ssqlite_commit); |
| 826 | defsubr (&Ssqlite_rollback); | 874 | defsubr (&Ssqlite_rollback); |
| 827 | defsubr (&Ssqlite_pragma); | 875 | defsubr (&Ssqlite_pragma); |
| 828 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | 876 | #if HAVE_LOAD_EXTENSION |
| 829 | defsubr (&Ssqlite_load_extension); | 877 | defsubr (&Ssqlite_load_extension); |
| 830 | #endif | 878 | #endif |
| 831 | defsubr (&Ssqlite_next); | 879 | defsubr (&Ssqlite_next); |
diff --git a/src/xdisp.c b/src/xdisp.c index 09f2f31816e..543dcba5fee 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -21186,8 +21186,10 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 21186 | pt_row = first_row_to_display; | 21186 | pt_row = first_row_to_display; |
| 21187 | } | 21187 | } |
| 21188 | 21188 | ||
| 21189 | if (first_row_to_display->y >= yb) | ||
| 21190 | return false; | ||
| 21191 | |||
| 21189 | /* Start displaying at the start of first_row_to_display. */ | 21192 | /* Start displaying at the start of first_row_to_display. */ |
| 21190 | eassert (first_row_to_display->y < yb); | ||
| 21191 | init_to_row_start (&it, w, first_row_to_display); | 21193 | init_to_row_start (&it, w, first_row_to_display); |
| 21192 | 21194 | ||
| 21193 | nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) | 21195 | nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) |