mirror of
https://github.com/sheumann/hush.git
synced 2025-03-27 17:30:33 +00:00
hush: style cleanups. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
f38b912fcf
commit
da463fb007
24
shell/hush.c
24
shell/hush.c
@ -2183,7 +2183,7 @@ static int o_save_ptr_helper(o_string *o, int n)
|
||||
n, string_len, string_start);
|
||||
o->has_empty_slot = 0;
|
||||
}
|
||||
list[n] = (char*)(ptrdiff_t)string_len;
|
||||
list[n] = (char*)(uintptr_t)string_len;
|
||||
return n + 1;
|
||||
}
|
||||
|
||||
@ -2193,7 +2193,7 @@ static int o_get_last_ptr(o_string *o, int n)
|
||||
char **list = (char**)o->data;
|
||||
int string_start = ((n + 0xf) & ~0xf) * sizeof(list[0]);
|
||||
|
||||
return ((int)(ptrdiff_t)list[n-1]) + string_start;
|
||||
return ((int)(uintptr_t)list[n-1]) + string_start;
|
||||
}
|
||||
|
||||
#ifdef HUSH_BRACE_EXP
|
||||
@ -2231,9 +2231,9 @@ static const char *next_brace_sub(const char *cp)
|
||||
cp++;
|
||||
continue;
|
||||
}
|
||||
/*{*/ if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
|
||||
if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
|
||||
break;
|
||||
if (*cp++ == '{') /*}*/
|
||||
if (*cp++ == '{')
|
||||
depth++;
|
||||
}
|
||||
|
||||
@ -2255,7 +2255,7 @@ static int glob_brace(char *pattern, o_string *o, int n)
|
||||
while (1) {
|
||||
if (*begin == '\0')
|
||||
goto simple_glob;
|
||||
if (*begin == '{') /*}*/ {
|
||||
if (*begin == '{') {
|
||||
/* Find the first sub-pattern and at the same time
|
||||
* find the rest after the closing brace */
|
||||
next = next_brace_sub(begin);
|
||||
@ -2263,7 +2263,7 @@ static int glob_brace(char *pattern, o_string *o, int n)
|
||||
/* An illegal expression */
|
||||
goto simple_glob;
|
||||
}
|
||||
/*{*/ if (*next == '}') {
|
||||
if (*next == '}') {
|
||||
/* "{abc}" with no commas - illegal
|
||||
* brace expr, disregard and skip it */
|
||||
begin = next + 1;
|
||||
@ -2280,7 +2280,7 @@ static int glob_brace(char *pattern, o_string *o, int n)
|
||||
|
||||
/* Now find the end of the whole brace expression */
|
||||
rest = next;
|
||||
/*{*/ while (*rest != '}') {
|
||||
while (*rest != '}') {
|
||||
rest = next_brace_sub(rest);
|
||||
if (rest == NULL) {
|
||||
/* An illegal expression */
|
||||
@ -2316,7 +2316,7 @@ static int glob_brace(char *pattern, o_string *o, int n)
|
||||
* That's why we re-copy prefix every time (1st memcpy above).
|
||||
*/
|
||||
n = glob_brace(new_pattern_buf, o, n);
|
||||
/*{*/ if (*next == '}') {
|
||||
if (*next == '}') {
|
||||
/* We saw the last entry */
|
||||
break;
|
||||
}
|
||||
@ -4990,7 +4990,6 @@ static char **expand_variables(char **argv, unsigned or_mask)
|
||||
{
|
||||
int n;
|
||||
char **list;
|
||||
char **v;
|
||||
o_string output = NULL_O_STRING;
|
||||
|
||||
/* protect against globbing for "$var"? */
|
||||
@ -4999,10 +4998,9 @@ static char **expand_variables(char **argv, unsigned or_mask)
|
||||
output.o_glob = 1 & (or_mask / EXPVAR_FLAG_GLOB);
|
||||
|
||||
n = 0;
|
||||
v = argv;
|
||||
while (*v) {
|
||||
n = expand_vars_to_list(&output, n, *v, (unsigned char)or_mask);
|
||||
v++;
|
||||
while (*argv) {
|
||||
n = expand_vars_to_list(&output, n, *argv, (unsigned char)or_mask);
|
||||
argv++;
|
||||
}
|
||||
debug_print_list("expand_variables", &output, n);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user