FreeNodeName
Synopsis
FreeNodeName(list, node)
A0 A1C Prototype
void FreeNodeName(struct List *list, struct Node *node);Description
FreeNodeName() is entirely similar to FreeNode(), with one difference: if the LN_NAME field in the Node structure is not NULL, that address is freed assuming it was previously allocated via exec/AllocVec(). If the LN_NAME field is NULL, FreeNodeName() behaves identically to FreeNode().
Inputs
- list — Address of the list that contains the node.
- node — Address of the node to remove.
Result
None.
Notes
FreeNodeName() assumes that the name pointer in LN_NAME was allocated using exec/AllocVec(). This is intended to encourage the use of exec/AllocVec() instead of the classic exec/AllocMem(), considering the ease of use of the former and the now-obsolete nature of the latter.
See Also
FreeList, FreeListName, FreeNode
exec/Remove(), exec/FreeVec()
Implementation
The original 68020 assembly implementation:
; (26-Feb-1995) --- FreeNodeName(list,node) (a0/a1)
_LVOFreeNodeName
movem.l a5-a6,-(sp)
move.l a1,a5 ; A5 = struct Node *
REMOVE ; exec MACROS
move.l ab_ExecBase(a6),a6 ; Get Exec...
move.l LN_NAME(a5),d0
beq.s OnlyNod
move.l d0,a1
move.l -(a1),d0
jsr _LVOFreeMem(a6) ; Free the string...
OnlyNod lea -4(a5),a1
moveq #4+LN_SIZE,d0
jsr _LVOFreeMem(a6) ; Free the Node...
movem.l (sp)+,a5-a6
rts