summaryrefslogtreecommitdiff
path: root/preproc.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-04-09 15:40:35 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-04-10 00:13:49 +0400
commited4a805b0ae81a485e952742e161f40f7302642f (patch)
tree2d6901a777414cfcfc4de45b1866f5c815fe5f75 /preproc.c
parent6837749d85139b37ca0f15cfe293ba078591d117 (diff)
downloadnasm-ed4a805b0ae81a485e952742e161f40f7302642f.tar.gz
nasm-ed4a805b0ae81a485e952742e161f40f7302642f.tar.bz2
nasm-ed4a805b0ae81a485e952742e161f40f7302642f.zip
expand_smacro: stylish nits
- no need to split functions even if it a bit longer then 80 characters, it becomes hard to read it - initialize "thead" before "tail" is more natural - use more simple while() instead of for() with a long initializer Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'preproc.c')
-rw-r--r--preproc.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/preproc.c b/preproc.c
index 1af58d9..1f617e0 100644
--- a/preproc.c
+++ b/preproc.c
@@ -3785,9 +3785,8 @@ static Token *expand_smacro(Token * tline)
* routine we copy it back
*/
if (org_tline) {
- tline =
- new_Token(org_tline->next, org_tline->type, org_tline->text,
- 0);
+ tline = new_Token(org_tline->next, org_tline->type,
+ org_tline->text, 0);
tline->a.mac = org_tline->a.mac;
nasm_free(org_tline->text);
org_tline->text = NULL;
@@ -3796,8 +3795,8 @@ static Token *expand_smacro(Token * tline)
expanded = true; /* Always expand %+ at least once */
again:
- tail = &thead;
thead = NULL;
+ tail = &thead;
while (tline) { /* main token loop */
if (!--deadman) {
@@ -3927,13 +3926,9 @@ again:
if (++nparam >= sparam) {
sparam += PARAM_DELTA;
params = nasm_realloc(params,
- sparam *
- sizeof(Token
- *));
- paramsize =
- nasm_realloc(paramsize,
- sparam *
- sizeof(int));
+ sparam * sizeof(Token *));
+ paramsize = nasm_realloc(paramsize,
+ sparam * sizeof(int));
}
params[nparam] = tline->next;
paramsize[nparam] = 0;
@@ -4015,11 +4010,10 @@ again:
int i;
ttt = params[t->type - TOK_SMAC_PARAM];
- for (i = paramsize[t->type - TOK_SMAC_PARAM];
- --i >= 0;) {
- pt = *ptail =
- new_Token(tline, ttt->type, ttt->text,
- 0);
+ i = paramsize[t->type - TOK_SMAC_PARAM];
+ while (--i >= 0) {
+ pt = *ptail = new_Token(tline, ttt->type,
+ ttt->text, 0);
ptail = &pt->next;
ttt = ttt->next;
}