}
if (paste && n > 0 && exp_tokens[n - 1]) {
- struct psi_token *old_tok = exp_tokens[n - 1];
+ struct psi_token *tmp_tok, *old_tok = exp_tokens[n - 1];
- new_tok = psi_token_init(old_tok->type, "", 0,
+ tmp_tok = psi_token_init(old_tok->type, "", 0,
target->col, target->line, target->file?:"");
- new_tok = psi_token_cat(NULL, 2, new_tok, old_tok, tok);
+ new_tok = psi_token_cat(NULL, 3, tmp_tok, old_tok, tok);
free(old_tok);
+ free(tmp_tok);
exp_tokens[n - 1] = new_tok;
} else {
arg_tokens[0] = psi_plist_init(NULL);
- /* free macro name token on success */
- tok = psi_cpp_tokiter_current(cpp);
- free_tokens = psi_plist_add(free_tokens, &tok);
-
/* next token must be a LPAREN for a macro call */
psi_cpp_tokiter_next(cpp);
tok = psi_cpp_tokiter_current(cpp);
/* back to where we took off */
psi_cpp_tokiter_seek(cpp, start);
+
+ free(target);
++cpp->expanded;
return true;
}