File tree Expand file tree Collapse file tree 5 files changed +21
-24
lines changed Expand file tree Collapse file tree 5 files changed +21
-24
lines changed Original file line number Diff line number Diff line change @@ -2752,6 +2752,15 @@ set_encoded_prompt(void)
2752
2752
}
2753
2753
}
2754
2754
2755
+ static char *
2756
+ set_warning_prompt_str (void )
2757
+ {
2758
+ return (conf .colorize == 1
2759
+ ? savestring (DEF_WPROMPT_STR , sizeof (DEF_WPROMPT_STR ) - 1 )
2760
+ : savestring (DEF_WPROMPT_STR_NO_COLOR ,
2761
+ sizeof (DEF_WPROMPT_STR_NO_COLOR ) - 1 ));
2762
+ }
2763
+
2755
2764
#define SETOPT (cmd_line , def ) ((cmd_line) == UNSET ? (def) : (cmd_line))
2756
2765
2757
2766
/* If some option was not set, set it to the default value. */
@@ -3004,13 +3013,8 @@ check_options(void)
3004
3013
3005
3014
set_prompt_options ();
3006
3015
3007
- if (!conf .wprompt_str ) {
3008
- if (conf .colorize == 1 )
3009
- conf .wprompt_str = savestring (DEF_WPROMPT_STR , sizeof (DEF_WPROMPT_STR ) - 1 );
3010
- else
3011
- conf .wprompt_str = savestring (DEF_WPROMPT_STR_NO_COLOR ,
3012
- sizeof (DEF_WPROMPT_STR_NO_COLOR ) - 1 );
3013
- }
3016
+ if (!conf .wprompt_str )
3017
+ conf .wprompt_str = set_warning_prompt_str ();
3014
3018
3015
3019
if ((xargs .stealth_mode == 1 || home_ok == 0 ||
3016
3020
config_ok == 0 || !config_file ) && !* div_line ) {
Original file line number Diff line number Diff line change @@ -2775,7 +2775,7 @@ rl_switch_workspace(const int n)
2775
2775
if (rl_line_buffer && * rl_line_buffer )
2776
2776
rl_delete_text (0 , rl_end );
2777
2777
2778
- char t [16 ];
2778
+ char t [MAX_INT_STR + 4 ];
2779
2779
exec_prompt_cmds = 1 ;
2780
2780
2781
2781
if (cur_ws == (n - 1 )) {
Original file line number Diff line number Diff line change @@ -1861,11 +1861,10 @@ handle_stdin(void)
1861
1861
* == (65535 * PATH_MAX)
1862
1862
* == 262MiB of data ((65535 * PATH_MAX) / 1024). */
1863
1863
1864
- size_t chunk = (size_t )512 * 1024 ;
1864
+ const size_t chunk = (size_t )512 * 1024 ;
1865
+ const size_t max_chunks = 512 ;
1865
1866
size_t chunks_n = 1 ;
1866
1867
size_t total_len = 0 ;
1867
- size_t max_chunks = 512 ;
1868
-
1869
1868
ssize_t input_len = 0 ;
1870
1869
1871
1870
/* Initial buffer allocation == 1 chunk */
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ sanitize_shell_level(char *str)
161
161
if (!str || !* str || !is_number (str ))
162
162
return FUNC_FAILURE ;
163
163
164
- int a = atoi (str );
164
+ const int a = atoi (str );
165
165
if (a < 1 || a > MAX_SHELL_LEVEL )
166
166
return FUNC_FAILURE ;
167
167
@@ -172,10 +172,10 @@ sanitize_shell_level(char *str)
172
172
static void
173
173
drop_privs (void )
174
174
{
175
- uid_t ruid = getuid ();
176
- uid_t euid = geteuid ();
177
- gid_t rgid = getgid ();
178
- gid_t egid = getegid ();
175
+ const uid_t ruid = getuid ();
176
+ const uid_t euid = geteuid ();
177
+ const gid_t rgid = getgid ();
178
+ const gid_t egid = getegid ();
179
179
180
180
if (rgid != egid ) {
181
181
int err = 0 ;
Original file line number Diff line number Diff line change @@ -359,12 +359,6 @@ print_sort_method(void)
359
359
putchar ('\n' );
360
360
}
361
361
362
- static inline void
363
- toggle_sort_reverse (void )
364
- {
365
- conf .sort_reverse = !conf .sort_reverse ;
366
- }
367
-
368
362
static inline int
369
363
re_sort_files_list (void )
370
364
{
@@ -421,7 +415,7 @@ sort_function(char **arg)
421
415
/* Argument is an alphanumerical string */
422
416
if (!is_number (arg [1 ])) {
423
417
if (* arg [1 ] == 'r' && strcmp (arg [1 ], "rev" ) == 0 ) {
424
- toggle_sort_reverse () ;
418
+ conf . sort_reverse = ! conf . sort_reverse ;
425
419
return re_sort_files_list ();
426
420
}
427
421
@@ -449,7 +443,7 @@ sort_function(char **arg)
449
443
conf .sort = n ;
450
444
451
445
if (arg [2 ] && * arg [2 ] == 'r' && strcmp (arg [2 ], "rev" ) == 0 )
452
- toggle_sort_reverse () ;
446
+ conf . sort_reverse = ! conf . sort_reverse ;
453
447
454
448
update_autocmd_opts (AC_SORT );
455
449
You can’t perform that action at this time.
0 commit comments