Page MenuHomePhabricator

c#: Implement IList to Eina.Array.
ClosedPublic

Authored by brunobelo on Dec 3 2019, 5:27 AM.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
brunobelo created this revision.Dec 3 2019, 5:27 AM
brunobelo requested review of this revision.Dec 3 2019, 5:27 AM
brunobelo planned changes to this revision.Dec 3 2019, 5:30 AM

more tests

jptiz added inline comments.Dec 4 2019, 11:56 AM
src/bindings/mono/eina_mono/eina_array.cs
626–638

Since all i != index are skipped, isn't this the same as the following?

for (int count = Count, j = count; j > index; --j)
{
    tmp[j] = tmp[j-1];
}
brunobelo updated this revision to Diff 27337.Dec 5 2019, 5:10 AM

add ownerships

brunobelo updated this revision to Diff 27338.Dec 5 2019, 6:30 AM

apply internal to Ownerships

brunobelo planned changes to this revision.Dec 9 2019, 1:39 PM
brunobelo updated this revision to Diff 27432.Dec 9 2019, 2:04 PM

updating ownerships.

brunobelo updated this revision to Diff 27487.Dec 11 2019, 7:55 AM

remove unused method.

lauromoura requested changes to this revision.Dec 12 2019, 9:08 AM

Needs rebasing

This revision now requires changes to proceed.Dec 12 2019, 9:08 AM
lauromoura requested changes to this revision.Dec 12 2019, 12:31 PM
lauromoura added inline comments.
src/bindings/mono/eina_mono/eina_array.cs
105

This may have slipped by in the D10742 review, but some docs here could be a good place to explain that the list is read-only due to either the contents or the container being owned by the native code.

617

"... is smaller than..."

624

Up to here the method is good, but for the actual insertion in the middle of the array we could do this in C (in a helper method in custom_exports_mono) manually instead of C#. Something like efl_mono_eina_array_insert_at(IntPtr array, uint index, IntPtr data)

We would pass to C the result of one of those NativeAlloc<T>(val). If the insert was not successful, we would free it with NativeFree<T>(data).

It would avoid doing unneccessary array relocations with CopyTo.

This revision now requires changes to proceed.Dec 12 2019, 12:31 PM
brunobelo planned changes to this revision.Dec 15 2019, 7:27 PM
brunobelo planned changes to this revision.Dec 16 2019, 11:27 AM
felipealmeida accepted this revision.Dec 22 2019, 6:31 AM
This revision was not accepted when it landed; it landed in state Needs Review.Dec 22 2019, 6:35 AM
This revision was automatically updated to reflect the committed changes.