mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
srcpos: Define srcpos_free
srcpos can be chained together using srcpos_extend. However, in such cases, we need to free all the chained nodes. srcpos_free is a helper to recursively free all the linked srcpos. Signed-off-by: Ayush Singh <ayush@beagleboard.org> Message-ID: <20250605-previous-value-v3-1-0983d0733a07@beagleboard.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e0b7749c26
commit
b841391bbd
3 changed files with 13 additions and 1 deletions
11
srcpos.c
11
srcpos.c
|
@ -287,6 +287,17 @@ struct srcpos *srcpos_extend(struct srcpos *pos, struct srcpos *newtail)
|
|||
return pos;
|
||||
}
|
||||
|
||||
void srcpos_free(struct srcpos *pos)
|
||||
{
|
||||
struct srcpos *p_next;
|
||||
|
||||
while (pos) {
|
||||
p_next = pos->next;
|
||||
free(pos);
|
||||
pos = p_next;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
srcpos_string(struct srcpos *pos)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue