Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set name if alias is nullptr for use #1056

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

Indra-db
Copy link
Contributor

@Indra-db Indra-db commented Oct 3, 2023

it's worth considering if there should be a default parameter value for alias, which is set to nullptr.

In case you agree to remove it, I'll update the PR and
set ecs_check(entity != 0 || name != NULL, ECS_INVALID_PARAMETER, NULL);
to
ecs_check(entity != 0 && name != NULL, ECS_INVALID_PARAMETER, NULL);
in
flecs_set_identifier function

In case we do, then the if(!name) check in use function is quite redundant and we could optionally remove it since flecs_set_identifier already deals will nullptr name where it just removes the previous alias and sets no new (as far as I understand)

it's worth considering if there should be a default parameter value for alias, which is set to nullptr.

In case you agree to remove it, I'll update the PR and set
ecs_check(entity != 0 || name != NULL, ECS_INVALID_PARAMETER, NULL);
to
ecs_check(entity != 0 && name != NULL, ECS_INVALID_PARAMETER, NULL);

in

ecs_entity_t flecs_set_identifier.

In case we do, then the if(!name) check in use is quite redundant and we could optionally remove it since flecs_set_identifier already deals will nullptr name where it just removes the previous alias and sets no new (as far as I understand)
@Indra-db
Copy link
Contributor Author

Indra-db commented Oct 3, 2023

optionally if it's nullptr, we could just early out and do nothing?
It seems a bit "bad" to remove the previous alias. I would classify that as unexpected behaviour.

edit: made discussions with Sander in private

@SanderMertens
Copy link
Owner

Thanks for the PR!

@SanderMertens SanderMertens merged commit 2f82ec2 into SanderMertens:master Oct 4, 2023
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants