tiny rewrite, make use of copy_substring()

This commit is contained in:
rlar 2010-11-06 17:52:36 +00:00
parent 2d6930b3bc
commit 4e8a1f9656
2 changed files with 10 additions and 15 deletions

View File

@ -1,3 +1,7 @@
2010-11-06 Robert Larice
* src/frontend/inpcom.c :
tiny rewrite, make use of copy_substring()
2010-11-06 Robert Larice 2010-11-06 Robert Larice
* src/frontend/diff.c : * src/frontend/diff.c :
tiny rewrite, make use of cieq() tiny rewrite, make use of cieq()

View File

@ -2764,7 +2764,6 @@ inp_fix_param_values( struct line *deck )
char *line, *beg_of_str, *end_of_str, *old_str, *equal_ptr, *new_str; char *line, *beg_of_str, *end_of_str, *old_str, *equal_ptr, *new_str;
char *vec_str, *natok, *buffer, *newvec, *whereisgt; char *vec_str, *natok, *buffer, *newvec, *whereisgt;
bool control_section = FALSE, has_paren = FALSE; bool control_section = FALSE, has_paren = FALSE;
int n = 0;
wordlist *wl, *nwl; wordlist *wl, *nwl;
while ( c != NULL ) { while ( c != NULL ) {
@ -2828,14 +2827,10 @@ inp_fix_param_values( struct line *deck )
/* A vector following the '=' token: code to put curly brackets around all params /* A vector following the '=' token: code to put curly brackets around all params
inside a pair of square brackets */ inside a pair of square brackets */
end_of_str = beg_of_str; end_of_str = beg_of_str;
n = 0; while (*end_of_str != ']')
while (*end_of_str != ']') {
end_of_str++; end_of_str++;
n++; /* string xx yyy from vector [xx yyy] */
} vec_str = copy_substring(beg_of_str + 1, end_of_str);
vec_str = TMALLOC(char, n); /* string xx yyy from vector [xx yyy] */
*vec_str = '\0';
strncat(vec_str, beg_of_str + 1, n - 1);
/* work on vector elements inside [] */ /* work on vector elements inside [] */
nwl = NULL; nwl = NULL;
@ -2900,14 +2895,10 @@ inp_fix_param_values( struct line *deck )
/* A complex value following the '=' token: code to put curly brackets around all params /* A complex value following the '=' token: code to put curly brackets around all params
inside a pair < > */ inside a pair < > */
end_of_str = beg_of_str; end_of_str = beg_of_str;
n = 0; while (*end_of_str != '>')
while (*end_of_str != '>') {
end_of_str++; end_of_str++;
n++; /* string xx yyy from vector [xx yyy] */
} vec_str = copy_substring(beg_of_str + 1, end_of_str);
vec_str = TMALLOC(char, n); /* string xx yyy from vector [xx yyy] */
*vec_str = '\0';
strncat(vec_str, beg_of_str + 1, n - 1);
/* work on tokens inside <> */ /* work on tokens inside <> */
nwl = NULL; nwl = NULL;