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

code health: don't mix FAILURE and -1 in get_spaceno_by_name() #168

Merged

Conversation

Totktonada
Copy link
Member

Technically we should return FAILURE (not -1) from the changed function
in case of a failure. FAILURE is -1 in fact and it unlikely will be
changed, but the only formal guarantee we have is that FAILURE is a
negative value.

Cited from 1:

typedef enum {
  SUCCESS =  0,
  FAILURE = -1,		/* this MUST stay a negative number, or it may affect functions! */
} ZEND_RESULT_CODE;

No behaviour actually changed in this commit.

It is the follow up for 5647d24 ('Fix
select() by space_no and index_name'), where we initially set eyes on
this point.

Follows up #42.

Technically we should return FAILURE (not -1) from the changed function
in case of a failure. FAILURE is -1 in fact and it unlikely will be
changed, but the only formal guarantee we have is that FAILURE is a
negative value.

Cited from [1]:

 | typedef enum {
 |   SUCCESS =  0,
 |   FAILURE = -1,		/* this MUST stay a negative number, or it may affect functions! */
 | } ZEND_RESULT_CODE;

No behaviour actually changed in this commit.

It is the follow up for 5647d24 ('Fix
select() by space_no and index_name'), where we initially set eyes on
this point.

[1]: https://github.com/php/php-src/blob/4903f7c5fde11a115f659ec54a1d0ede6fd7232c/Zend/zend_types.h#L53-L56

Follows up #42.
@Totktonada Totktonada requested a review from LeonidVas July 17, 2020 13:22
@Totktonada Totktonada merged commit 7c20812 into master Jul 17, 2020
@Totktonada Totktonada deleted the Totktonada/gh-42-select-space-no-index-name-follow-up branch July 17, 2020 17:41
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