mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
Revert "annotations: add positions"
This reverts commit baa1d2cf78
.
Turns out this introduced memory badness. valgrind picks it up on
x86, but it straight out SEGVs on x86.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
403cc79f06
commit
a3143fafbf
7 changed files with 23 additions and 67 deletions
22
srcpos.c
22
srcpos.c
|
@ -207,7 +207,6 @@ struct srcpos srcpos_empty = {
|
|||
.last_line = 0,
|
||||
.last_column = 0,
|
||||
.file = NULL,
|
||||
.next = NULL,
|
||||
};
|
||||
|
||||
void srcpos_update(struct srcpos *pos, const char *text, int len)
|
||||
|
@ -235,34 +234,13 @@ struct srcpos *
|
|||
srcpos_copy(struct srcpos *pos)
|
||||
{
|
||||
struct srcpos *pos_new;
|
||||
struct srcfile_state *srcfile_state;
|
||||
|
||||
if (!pos)
|
||||
return NULL;
|
||||
|
||||
pos_new = xmalloc(sizeof(struct srcpos));
|
||||
memcpy(pos_new, pos, sizeof(struct srcpos));
|
||||
|
||||
/* allocate without free */
|
||||
srcfile_state = xmalloc(sizeof(struct srcfile_state));
|
||||
memcpy(srcfile_state, pos->file, sizeof(struct srcfile_state));
|
||||
pos_new->file = srcfile_state;
|
||||
|
||||
return pos_new;
|
||||
}
|
||||
|
||||
struct srcpos *srcpos_extend(struct srcpos *pos, struct srcpos *newtail)
|
||||
{
|
||||
struct srcpos *p;
|
||||
|
||||
if (!pos)
|
||||
return newtail;
|
||||
|
||||
for (p = pos; p->next != NULL; p = p->next);
|
||||
p->next = newtail;
|
||||
return pos;
|
||||
}
|
||||
|
||||
char *
|
||||
srcpos_string(struct srcpos *pos)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue