Remove/update confusing comments. Separate acquire and assign operations for pointer functions.

This commit is contained in:
rfm 2024-07-17 15:42:33 +01:00
parent f6b8c83bd0
commit c435c6d7d6
4 changed files with 37 additions and 47 deletions

View file

@ -139,23 +139,17 @@ static inline void pointerFunctionsAssign(PFInfo *PF, void **addr, void *value)
}
}
/* Acquire the pointer value to store for the specified item.
*/
static inline void *
pointerFunctionsAcquire(PFInfo *PF, void **dst, void *src)
pointerFunctionsAcquire(PFInfo *PF, void *src)
{
if (PF->acquireFunction != 0)
src = (*PF->acquireFunction)(src, PF->sizeFunction,
PF->options & NSPointerFunctionsCopyIn ? YES : NO);
// FIXME: This shouldn't be here. Acquire and assign are separate
// operations. Acquire is for copy-in operations (i.e. retain / copy),
// assign is for move operations of already-owned pointers. Combining them
// like this is Just Plain Wrong™
pointerFunctionsAssign(PF, dst, src);
{
src = (*PF->acquireFunction)(src, PF->sizeFunction,
PF->options & NSPointerFunctionsCopyIn ? YES : NO);
}
return src;
}
/**
* Moves a pointer from location to another.
*/