diff options
| author | Paul Eggert | 2015-01-19 00:56:18 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-01-19 01:01:58 -0800 |
| commit | b7f83adda5a32140811e8e7decc4394d64cada3d (patch) | |
| tree | 98d7d6763a62fc033464e4f2d5edde5c937623dd /src/fileio.c | |
| parent | 9592a014df784e67a4647d5b6424f2758dfaad3c (diff) | |
| download | emacs-b7f83adda5a32140811e8e7decc4394d64cada3d.tar.gz emacs-b7f83adda5a32140811e8e7decc4394d64cada3d.zip | |
Prefer memset to repeatedly assigning Qnil
* alloc.c (allocate_pseudovector): Catch more bogus values.
* alloc.c (allocate_pseudovector):
* callint.c (Fcall_interactively):
* coding.c (syms_of_coding):
* fringe.c (init_fringe):
Verify that Qnil == 0.
* callint.c (Fcall_interactively):
* eval.c (Fapply, Ffuncall):
* fns.c (mapcar1, larger_vector):
* font.c (font_expand_wildcards):
* fringe.c (init_fringe):
Prefer memset to assigning zeros by hand.
* callint.c (Fcall_interactively):
Remove duplicate assignment of Qnil to args[i].
* coding.c (syms_of_coding):
Prefer LISP_INITIALLY_ZERO to assigning zeros by hand.
* fileio.c (Ffile_selinux_context):
Rewrite to avoid need for Lisp_Object array.
* lisp.h (XLI_BUILTIN_LISPSYM): New macro.
(DEFINE_LISP_SYMBOL_END): Use it.
(NIL_IS_ZERO): New constant.
(memsetnil): New function.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/fileio.c b/src/fileio.c index dc67a00ed2a..ff6720d4ae2 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2812,7 +2812,8 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2812 | (Lisp_Object filename) | 2812 | (Lisp_Object filename) |
| 2813 | { | 2813 | { |
| 2814 | Lisp_Object absname; | 2814 | Lisp_Object absname; |
| 2815 | Lisp_Object values[4]; | 2815 | Lisp_Object user = Qnil, role = Qnil, type = Qnil, range = Qnil; |
| 2816 | |||
| 2816 | Lisp_Object handler; | 2817 | Lisp_Object handler; |
| 2817 | #if HAVE_LIBSELINUX | 2818 | #if HAVE_LIBSELINUX |
| 2818 | security_context_t con; | 2819 | security_context_t con; |
| @@ -2830,10 +2831,6 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2830 | 2831 | ||
| 2831 | absname = ENCODE_FILE (absname); | 2832 | absname = ENCODE_FILE (absname); |
| 2832 | 2833 | ||
| 2833 | values[0] = Qnil; | ||
| 2834 | values[1] = Qnil; | ||
| 2835 | values[2] = Qnil; | ||
| 2836 | values[3] = Qnil; | ||
| 2837 | #if HAVE_LIBSELINUX | 2834 | #if HAVE_LIBSELINUX |
| 2838 | if (is_selinux_enabled ()) | 2835 | if (is_selinux_enabled ()) |
| 2839 | { | 2836 | { |
| @@ -2842,20 +2839,20 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2842 | { | 2839 | { |
| 2843 | context = context_new (con); | 2840 | context = context_new (con); |
| 2844 | if (context_user_get (context)) | 2841 | if (context_user_get (context)) |
| 2845 | values[0] = build_string (context_user_get (context)); | 2842 | user = build_string (context_user_get (context)); |
| 2846 | if (context_role_get (context)) | 2843 | if (context_role_get (context)) |
| 2847 | values[1] = build_string (context_role_get (context)); | 2844 | role = build_string (context_role_get (context)); |
| 2848 | if (context_type_get (context)) | 2845 | if (context_type_get (context)) |
| 2849 | values[2] = build_string (context_type_get (context)); | 2846 | type = build_string (context_type_get (context)); |
| 2850 | if (context_range_get (context)) | 2847 | if (context_range_get (context)) |
| 2851 | values[3] = build_string (context_range_get (context)); | 2848 | range = build_string (context_range_get (context)); |
| 2852 | context_free (context); | 2849 | context_free (context); |
| 2853 | freecon (con); | 2850 | freecon (con); |
| 2854 | } | 2851 | } |
| 2855 | } | 2852 | } |
| 2856 | #endif | 2853 | #endif |
| 2857 | 2854 | ||
| 2858 | return Flist (ARRAYELTS (values), values); | 2855 | return list4 (user, role, type, range); |
| 2859 | } | 2856 | } |
| 2860 | 2857 | ||
| 2861 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, | 2858 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, |