aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorPo Lu2024-05-09 14:58:45 +0800
committerPo Lu2024-05-09 15:07:22 +0800
commit67ab6bcdbac572a6266d7c9d15833bd2ddd049fa (patch)
tree3469eaa3f625da33e3c5c5e0e91cc5c202552c81 /src/dbusbind.c
parent9b7dd30807ed4be9afe4f66cfa5130aa7d178989 (diff)
downloademacs-67ab6bcdbac572a6266d7c9d15833bd2ddd049fa.tar.gz
emacs-67ab6bcdbac572a6266d7c9d15833bd2ddd049fa.zip
Replace calls to intern with a constant string with DEFSYMs
* src/alloc.c (display_malloc_warning, syms_of_alloc): * src/buffer.c (Fmake_indirect_buffer, Fbuffer_local_variables) (Frename_buffer, Fkill_buffer, Fset_buffer_major_mode) (Fset_buffer_multibyte, syms_of_buffer): * src/callint.c (read_file_name, Fcall_interactively) (syms_of_callint): * src/callproc.c (call_process, create_temp_file) (syms_of_callproc): * src/charset.c (Fdefine_charset_internal, syms_of_charset): * src/cmds.c (internal_self_insert, syms_of_cmds): * src/coding.c (record_conversion_result) (Fdefine_coding_system_internal, syms_of_coding): * src/dbusbind.c (xd_signature, Fdbus_message_internal) (syms_of_dbusbind): * src/dispnew.c (init_faces_initial): * src/doc.c (Fsnarf_documentation, syms_of_doc): * src/dosfns.c (system_process_attributes, syms_of_dosfns): * src/emacs.c (init_cmdargs, Fdump_emacs, decode_env_path) (syms_of_emacs): * src/eval.c (call_debugger, Fdefvaralias, syms_of_eval): * src/fileio.c (barf_or_query_if_file_exists) (Finsert_file_contents, auto_save_error, Fdo_auto_save) (syms_of_fileio): * src/filelock.c (lock_file_1, syms_of_filelock): * src/fontset.c (fontset_from_font, syms_of_fontset): * src/frame.c (make_frame_without_minibuffer, syms_of_frame): * src/gnutls.c (emacs_gnutls_certificate_details) (Fgnutls_peer_status_warning_describe, Fgnutls_peer_status) (gnutls_verify_boot, syms_of_gnutls): * src/gtkutil.c (style_changed_cb, find_rtl_image): * src/image.c (imagemagick_filename_hint, gs_load) (syms_of_image): * src/keyboard.c (command_loop_1, read_char, timer_start_idle) (read_char_minibuf_menu_prompt, Fsuspend_emacs) (syms_of_keyboard): * src/keymap.c (Fmap_keymap, Flookup_key, Fdescribe_vector) (describe_vector, syms_of_keymap): * src/lread.c (Fread, Fread_positioning_symbols, syms_of_lread): * src/minibuf.c (Fabort_minibuffers, Fread_buffer) (Fcompleting_read, syms_of_minibuf): * src/msdos.c (XMenuActivate, run_msdos_command, syms_of_msdos): * src/nsfns.m (Fx_display_backing_store, Fx_display_visual_class) (Fns_hide_emacs, Fsystem_move_file_to_trash, ns_create_tip_frame) (x_hide_tip, Fx_show_tip, syms_of_nsfns): * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (syms_of_nsfont): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (Fx_display_visual_class, x_create_tip_frame) (Fx_show_tip, syms_of_pgtkfns): * src/pgtkterm.c (syms_of_pgtkterm, pgtk_cr_export_frames): * src/term.c (term_get_fkeys_1, set_tty_color_mode, Fsuspend_tty) (Fresume_tty, tty_menu_activate, syms_of_term): * src/terminal.c (create_terminal, syms_of_terminal): * src/w32fns.c (Fx_display_backing_store) (Fx_display_visual_class, Fset_message_beep, Fx_open_connection) (Fx_show_tip, Fx_file_dialog, Fsystem_move_file_to_trash) (Fw32_toggle_lock_key, syms_of_w32fns): * src/w32font.c (w32_enumfont_pattern_entity, syms_of_w32font): * src/w32term.c (w32_bitmap_icon, syms_of_w32term): * src/xdisp.c (message_dolog, define_frame_cursor1) (syms_of_xdisp): * src/xfaces.c (tty_lookup_color, syms_of_xfaces): * src/xml.c (make_dom, syms_of_xml): * src/xterm.c (syms_of_xterm): * src/xwidget.c (store_xwidget_download_callback_event) (store_xwidget_js_callback_event, syms_of_xwidget): Define symbols for symbols interned with `intern' from a constant string, delete duplicate DEFSYM directives, and substitute them for such calls to intern. This excludes only those symbols which are interned and referenced only once during Emacs's initialization, the timing of whose interning is inconsequential, and symbols in w32.c, which would need to be transferred to a new syms_of_w32 function that I cannot test.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 0441b07a3b2..9f93f2894c2 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -474,7 +474,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
474 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); 474 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt));
475 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); 475 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
476 if (strcmp (subsig, x) != 0) 476 if (strcmp (subsig, x) != 0)
477 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (elt)); 477 wrong_type_argument (QD_Bus, CAR_SAFE (elt));
478 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); 478 elt = CDR_SAFE (XD_NEXT_VALUE (elt));
479 } 479 }
480 480
@@ -493,7 +493,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
493 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); 493 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
494 494
495 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) 495 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
496 wrong_type_argument (intern ("D-Bus"), 496 wrong_type_argument (QD_Bus,
497 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); 497 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
498 498
499 sprintf (signature, "%c", dtype); 499 sprintf (signature, "%c", dtype);
@@ -528,7 +528,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
528 528
529 /* Check the parent object type. */ 529 /* Check the parent object type. */
530 if (parent_type != DBUS_TYPE_ARRAY) 530 if (parent_type != DBUS_TYPE_ARRAY)
531 wrong_type_argument (intern ("D-Bus"), object); 531 wrong_type_argument (QD_Bus, object);
532 532
533 /* Compose the signature from the elements. It is enclosed by 533 /* Compose the signature from the elements. It is enclosed by
534 curly braces. */ 534 curly braces. */
@@ -542,7 +542,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
542 xd_signature_cat (signature, x); 542 xd_signature_cat (signature, x);
543 543
544 if (!XD_BASIC_DBUS_TYPE (subtype)) 544 if (!XD_BASIC_DBUS_TYPE (subtype))
545 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); 545 wrong_type_argument (QD_Bus, CAR_SAFE (XD_NEXT_VALUE (elt)));
546 546
547 /* Second element. */ 547 /* Second element. */
548 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); 548 elt = CDR_SAFE (XD_NEXT_VALUE (elt));
@@ -552,7 +552,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
552 xd_signature_cat (signature, x); 552 xd_signature_cat (signature, x);
553 553
554 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) 554 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
555 wrong_type_argument (intern ("D-Bus"), 555 wrong_type_argument (QD_Bus,
556 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); 556 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt))));
557 557
558 /* Closing signature. */ 558 /* Closing signature. */
@@ -560,7 +560,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
560 break; 560 break;
561 561
562 default: 562 default:
563 wrong_type_argument (intern ("D-Bus"), object); 563 wrong_type_argument (QD_Bus, object);
564 } 564 }
565 565
566 XD_DEBUG_MESSAGE ("%s", signature); 566 XD_DEBUG_MESSAGE ("%s", signature);
@@ -1480,7 +1480,7 @@ usage: (dbus-message-internal &rest REST) */)
1480 bus or an unknown name, we regard it as broadcast message 1480 bus or an unknown name, we regard it as broadcast message
1481 due to backward compatibility. */ 1481 due to backward compatibility. */
1482 if (dbus_bus_name_has_owner (connection, SSDATA (service), NULL)) 1482 if (dbus_bus_name_has_owner (connection, SSDATA (service), NULL))
1483 uname = call2 (intern ("dbus-get-name-owner"), bus, service); 1483 uname = call2 (Qdbus_get_name_owner, bus, service);
1484 else 1484 else
1485 uname = Qnil; 1485 uname = Qnil;
1486 1486
@@ -1886,6 +1886,7 @@ syms_of_dbusbind (void)
1886 list2 (Qdbus_error, Qerror)); 1886 list2 (Qdbus_error, Qerror));
1887 Fput (Qdbus_error, Qerror_message, 1887 Fput (Qdbus_error, Qerror_message,
1888 build_pure_c_string ("D-Bus error")); 1888 build_pure_c_string ("D-Bus error"));
1889 DEFSYM (QD_Bus, "D-Bus");
1889 1890
1890 /* Lisp symbols of the system and session buses. */ 1891 /* Lisp symbols of the system and session buses. */
1891 DEFSYM (QCsystem, ":system"); 1892 DEFSYM (QCsystem, ":system");
@@ -1924,6 +1925,9 @@ syms_of_dbusbind (void)
1924 DEFSYM (QCsignal, ":signal"); 1925 DEFSYM (QCsignal, ":signal");
1925 DEFSYM (QCmonitor, ":monitor"); 1926 DEFSYM (QCmonitor, ":monitor");
1926 1927
1928 /* Miscellaneous Lisp symbols. */
1929 DEFSYM (Qdbus_get_name_owner, "dbus-get-name-owner");
1930
1927 DEFVAR_LISP ("dbus-compiled-version", 1931 DEFVAR_LISP ("dbus-compiled-version",
1928 Vdbus_compiled_version, 1932 Vdbus_compiled_version,
1929 doc: /* The version of D-Bus Emacs is compiled against. */); 1933 doc: /* The version of D-Bus Emacs is compiled against. */);