}
struct macro *m = xmalloc (sizeof *m);
- *m = (struct macro) {
- .name = xstrdup (name),
- .location = xmalloc (sizeof *m->location),
- };
- *m->location = (struct msg_location) {
- .file_name = intern_new_if_nonnull (lex_get_file_name (lexer)),
- .first_line = lex_get_first_line_number (lexer, 0),
- };
+ *m = (struct macro) { .name = xstrdup (name) };
+ int first_line = lex_get_first_line_number (lexer, 0);
lex_get (lexer);
if (!lex_force_match (lexer, T_LPAREN))
ds_put_byte (&body, '\n');
lex_get (lexer);
}
- m->location->last_line = lex_get_last_line_number (lexer, 0);
+
+ int last_line = lex_get_last_line_number (lexer, 0) - 1;
+ m->location = xmalloc (sizeof *m->location);
+ *m->location = (struct msg_location) {
+ .file_name = intern_new_if_nonnull (lex_get_file_name (lexer)),
+ .p[0] = { .line = first_line },
+ .p[1] = { .line = last_line },
+ };
macro_tokens_from_string (&m->body, body.ss, lex_get_syntax_mode (lexer));
ds_destroy (&body);