Breaking: size_t indices #1366

Closed
NickGerleman wants to merge 3 commits from export-D49130914 into main
NickGerleman commented 2023-09-10 03:22:20 -07:00 (Migrated from github.com)

Summary:
Yoga's public API exposes indices most often as uint32_t, with exception of clone callbacks which are int32_t. Yoga internally represents these indices as size_t when dealing with the child vector, and this is the true index.

This changes the API to consistently be size_t. This should not be breaking for most users, but will cause breaks where:

  1. Users set a clone node callback (I think this should be rare. RN uses it, but only because it relies on a separate private API).
  2. Callers of YGNodeGetChildCount() are assigning to an int with less width than size_t and have strong warnings enabled.
  3. Using a newer Yoga binary with older source, since we are not preserving ABI compatibility (Yoga in general does not aim to be ABI stable between major versions, only ABI safe for a given set of sources).

Changelog: [Internal]

Differential Revision: D49130914

Summary: Yoga's public API exposes indices most often as `uint32_t`, with exception of clone callbacks which are `int32_t`. Yoga internally represents these indices as `size_t` when dealing with the child vector, and this is the true index. This changes the API to consistently be `size_t`. This should not be breaking for most users, but will cause breaks where: 1. Users set a clone node callback (I think this should be rare. RN uses it, but only because it relies on a separate private API). 2. Callers of `YGNodeGetChildCount()` are assigning to an int with less width than `size_t` and have strong warnings enabled. 3. Using a newer Yoga binary with older source, since we are not preserving ABI compatibility (Yoga in general does not aim to be ABI stable between major versions, only ABI safe for a given set of sources). Changelog: [Internal] Differential Revision: D49130914
facebook-github-bot commented 2023-09-10 03:23:01 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-10 03:30:24 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-10 03:34:20 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-10 04:00:22 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-10 07:17:02 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 16:19:36 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 17:05:40 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 17:35:44 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 18:36:11 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 19:01:50 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D49130914

This pull request was **exported** from Phabricator. Differential Revision: [D49130914](https://www.internalfb.com/diff/D49130914)
facebook-github-bot commented 2023-09-11 19:56:57 -07:00 (Migrated from github.com)

This pull request has been merged in facebook/yoga@776065d7c7.

This pull request has been merged in facebook/yoga@776065d7c70b2c9f5a7d484819fdf9b9a39a1f82.

Pull request closed

Sign in to join this conversation.
No description provided.