inpcom.c, cleanup

This commit is contained in:
rlar 2013-05-29 22:49:21 +02:00
parent d0c45d2af1
commit 56e55ea8a0
1 changed files with 9 additions and 10 deletions

View File

@ -892,8 +892,7 @@ readline(FILE *fd)
while ((c = getc(fd)) != EOF) { while ((c = getc(fd)) != EOF) {
if (strlen == 0 && (c == '\t' || c == ' ')) /* Leading spaces away */ if (strlen == 0 && (c == '\t' || c == ' ')) /* Leading spaces away */
continue; continue;
strptr[strlen] = (char) c; strptr[strlen++] = (char) c;
strlen++;
if (strlen >= memlen) { if (strlen >= memlen) {
memlen += STRGROW; memlen += STRGROW;
if ((strptr = TREALLOC(char, strptr, memlen + 1)) == NULL) if ((strptr = TREALLOC(char, strptr, memlen + 1)) == NULL)
@ -940,7 +939,8 @@ inp_fix_gnd_name(struct line *c)
} }
static struct line* static struct line*
create_new_card(char *card_str, int *line_number) { create_new_card(char *card_str, int *line_number)
{
struct line *newcard = alloc(struct line); struct line *newcard = alloc(struct line);
newcard->li_line = strdup(card_str); newcard->li_line = strdup(card_str);
@ -1215,7 +1215,7 @@ inp_fix_macro_param_func_paren_io(struct line *card)
} }
if (*str_ptr == '(') { if (*str_ptr == '(') {
*str_ptr = ' '; *str_ptr = ' ';
while (*str_ptr && *str_ptr != '\0') { while (*str_ptr != '\0') {
if (*str_ptr == ')') { if (*str_ptr == ')') {
*str_ptr = ' '; *str_ptr = ' ';
break; break;
@ -1811,6 +1811,8 @@ inp_fix_ternary_operator(struct line *card)
for (; card; card = card->li_next) { for (; card; card = card->li_next) {
char *line = card->li_line; char *line = card->li_line;
if (*line == '*')
continue;
/* exclude replacement of ternary function between .control and .endc */ /* exclude replacement of ternary function between .control and .endc */
if (ciprefix(".control", line)) if (ciprefix(".control", line))
found_control = TRUE; found_control = TRUE;
@ -1822,8 +1824,6 @@ inp_fix_ternary_operator(struct line *card)
/* ternary operator for B source done elsewhere */ /* ternary operator for B source done elsewhere */
if (*line == 'B' || *line == 'b') if (*line == 'B' || *line == 'b')
continue; continue;
if (*line == '*')
continue;
/* .param, .func, and .meas lines handled here (2nd argument FALSE) */ /* .param, .func, and .meas lines handled here (2nd argument FALSE) */
if (strchr(line, '?') && strchr(line, ':')) if (strchr(line, '?') && strchr(line, ':'))
card->li_line = inp_fix_ternary_operator_str(line, FALSE); card->li_line = inp_fix_ternary_operator_str(line, FALSE);
@ -1954,7 +1954,7 @@ inp_change_quotes(char *s)
{ {
bool first_quote = FALSE; bool first_quote = FALSE;
while (*s) { for (; *s; s++)
if (*s == '\'') { if (*s == '\'') {
if (first_quote == FALSE) { if (first_quote == FALSE) {
*s = '{'; *s = '{';
@ -1964,8 +1964,6 @@ inp_change_quotes(char *s)
first_quote = FALSE; first_quote = FALSE;
} }
} }
s++;
}
} }
@ -5664,7 +5662,8 @@ inp_poly_err(struct line *card)
/* get the fourth token in a controlled source line and exit, /* get the fourth token in a controlled source line and exit,
if it is 'poly' */ if it is 'poly' */
if ((ciprefix("e", curr_line)) || (ciprefix("g", curr_line)) || if ((ciprefix("e", curr_line)) || (ciprefix("g", curr_line)) ||
(ciprefix("f", curr_line)) || (ciprefix("h", curr_line))) { (ciprefix("f", curr_line)) || (ciprefix("h", curr_line)))
{
txfree(gettok(&curr_line)); txfree(gettok(&curr_line));
txfree(gettok(&curr_line)); txfree(gettok(&curr_line));
txfree(gettok(&curr_line)); txfree(gettok(&curr_line));