awk: style fixes
This commit is contained in:
parent
6dc6ebbf44
commit
e1d3e034a9
@ -848,19 +848,15 @@ static uint32_t next_token(uint32_t expected)
|
|||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (t.rollback) {
|
if (t.rollback) {
|
||||||
|
|
||||||
t.rollback = FALSE;
|
t.rollback = FALSE;
|
||||||
|
|
||||||
} else if (concat_inserted) {
|
} else if (concat_inserted) {
|
||||||
|
|
||||||
concat_inserted = FALSE;
|
concat_inserted = FALSE;
|
||||||
t.tclass = save_tclass;
|
t.tclass = save_tclass;
|
||||||
t.info = save_info;
|
t.info = save_info;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
p = pos;
|
p = pos;
|
||||||
|
|
||||||
readnext:
|
readnext:
|
||||||
skip_spaces(&p);
|
skip_spaces(&p);
|
||||||
lineno = t.lineno;
|
lineno = t.lineno;
|
||||||
@ -1402,7 +1398,7 @@ static void qrealloc(char **b, int n, int *size)
|
|||||||
/* resize field storage space */
|
/* resize field storage space */
|
||||||
static void fsrealloc(int size)
|
static void fsrealloc(int size)
|
||||||
{
|
{
|
||||||
static int maxfields = 0;
|
static int maxfields; /* = 0;*/
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (size >= maxfields) {
|
if (size >= maxfields) {
|
||||||
@ -1457,8 +1453,8 @@ static int awk_split(char *s, node *spl, char **slist)
|
|||||||
}
|
}
|
||||||
} else if (c[0] == '\0') { /* null split */
|
} else if (c[0] == '\0') { /* null split */
|
||||||
while (*s) {
|
while (*s) {
|
||||||
*(s1++) = *(s++);
|
*s1++ = *s++;
|
||||||
*(s1++) = '\0';
|
*s1++ = '\0';
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
} else if (c[0] != ' ') { /* single-character split */
|
} else if (c[0] != ' ') { /* single-character split */
|
||||||
@ -1468,7 +1464,7 @@ static int awk_split(char *s, node *spl, char **slist)
|
|||||||
}
|
}
|
||||||
if (*s1) n++;
|
if (*s1) n++;
|
||||||
while ((s1 = strpbrk(s1, c))) {
|
while ((s1 = strpbrk(s1, c))) {
|
||||||
*(s1++) = '\0';
|
*s1++ = '\0';
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
} else { /* space split */
|
} else { /* space split */
|
||||||
@ -1477,8 +1473,8 @@ static int awk_split(char *s, node *spl, char **slist)
|
|||||||
if (!*s) break;
|
if (!*s) break;
|
||||||
n++;
|
n++;
|
||||||
while (*s && !isspace(*s))
|
while (*s && !isspace(*s))
|
||||||
*(s1++) = *(s++);
|
*s1++ = *s++;
|
||||||
*(s1++) = '\0';
|
*s1++ = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
@ -1540,7 +1536,8 @@ static void handle_special(var *v)
|
|||||||
memcpy(b+len, s, l);
|
memcpy(b+len, s, l);
|
||||||
len += l;
|
len += l;
|
||||||
}
|
}
|
||||||
if (b) b[len] = '\0';
|
if (b)
|
||||||
|
b[len] = '\0';
|
||||||
setvar_p(V[F0], b);
|
setvar_p(V[F0], b);
|
||||||
is_f0_split = TRUE;
|
is_f0_split = TRUE;
|
||||||
|
|
||||||
@ -1781,7 +1778,6 @@ static char *awk_printf(node *n)
|
|||||||
|
|
||||||
/* if there was an error while sprintf, return value is negative */
|
/* if there was an error while sprintf, return value is negative */
|
||||||
if (i < j) i = j;
|
if (i < j) i = j;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b = xrealloc(b, i + 1);
|
b = xrealloc(b, i + 1);
|
||||||
@ -2053,6 +2049,7 @@ static var *evaluate(node *op, var *res)
|
|||||||
static var *fnargs = NULL;
|
static var *fnargs = NULL;
|
||||||
static unsigned seed = 1;
|
static unsigned seed = 1;
|
||||||
static regex_t sreg;
|
static regex_t sreg;
|
||||||
|
|
||||||
node *op1;
|
node *op1;
|
||||||
var *v1;
|
var *v1;
|
||||||
union {
|
union {
|
||||||
@ -2224,9 +2221,8 @@ static var *evaluate(node *op, var *res)
|
|||||||
|
|
||||||
case XC( OC_FNARG ):
|
case XC( OC_FNARG ):
|
||||||
L.v = &fnargs[op->l.i];
|
L.v = &fnargs[op->l.i];
|
||||||
|
|
||||||
v_cont:
|
v_cont:
|
||||||
res = (op->r.n) ? findvar(iamarray(L.v), R.s) : L.v;
|
res = op->r.n ? findvar(iamarray(L.v), R.s) : L.v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XC( OC_IN ):
|
case XC( OC_IN ):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user