ptrs_list: simplify remove_at implementation 20/287920/1
authorMichal Bloch <m.bloch@samsung.com>
Tue, 7 Feb 2023 16:29:44 +0000 (17:29 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Tue, 7 Feb 2023 18:05:53 +0000 (19:05 +0100)
commit7a3e36877ab74eb50e9e444a113a7c043efbb1a8
tree1723b4a602a1f3b22f11b621e8ca98c92c40e04d
parent2db497624ce42c576c0076b5e29a24a856a7f53b
ptrs_list: simplify remove_at implementation

Consider a table with memory layout like this:

[A]->[B]->[C]->[D]

Now, consider the removal of B. Intuitively it would result in:

[A]------>[C]->[D]

Which is what will happen now. Previously, what happened was:

[A]->[C]------>[D]

meaning B wasn't actually removed; rather, C was removed and
B took on the value of C. This was not only needlessly complex
but also made it difficult to implement "safe" iteration
that lets one remove the value being iterated on, which is
going to be implemented in a subsequent patch.

Change-Id: Icca3066ecd7c6a33b3eaf9655780c1ffc97ba722
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/shared/ptrs_list.c