[go: nahoru, domu]

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

'ssize_t' should be used for h2o_find_header/h2o_find_header_by_str #2033

Merged
merged 3 commits into from
Apr 19, 2019

Conversation

chenbd
Copy link
Contributor
@chenbd chenbd commented Apr 14, 2019

This PR trying clean up some code for 'lib/core/headers.c'

@chenbd
Copy link
Contributor Author
chenbd commented Apr 15, 2019

Not sure about the ci error, Issue in test code??

   #   Failed test 'upper bound'
        #   at t/50server-timing.t line 153.
        #     '1304.384'
        #         <
        #     '1100'
        # Looks like you failed 1 test of 3.
    
    #   Failed test 'response'
    #   at t/50server-timing.t line 154.
        
        #   Failed test 'upper bound'
        #   at t/50server-timing.t line 153.
        #     '2303.802'
        #         <
        #     '2100'
        # Looks like you failed 1 test of 3.
    
    #   Failed test 'total'
    #   at t/50server-timing.t line 154.
    # Looks like you failed 2 tests of 9

Copy link
Member
@kazuho kazuho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for spotting the issue and working on the fix.

I've left my comments on API changes that I might be concerned about, but things look OK otherwise.

@@ -106,7 +106,7 @@ ssize_t h2o_set_header_token(h2o_mem_pool_t *pool, h2o_headers_t *headers, const
/**
* deletes a header from list
*/
ssize_t h2o_delete_header(h2o_headers_t *headers, ssize_t cursor);
void h2o_delete_header(h2o_headers_t *headers, ssize_t cursor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a necessity to change the API? Unless there is, I'd prefer keeping the API as-is (consider the users of libh2o).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed.
Do we need consider keeping API stable from now on?
And for this function the return value seems useless because i can not image how the library user can use the return value(perhaps call h2o_delete_header again with return value?).
Anyway, leave it as-is.

@@ -24,7 +24,7 @@
#include "h2o.h"

static ssize_t add_header(h2o_mem_pool_t *pool, h2o_headers_t *headers, h2o_iovec_t *name, const char *orig_name, const char *value,
size_t value_len, h2o_header_flags_t flags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer retaining the argument. It's true that we are not using it now, but it's harmless, it's good to have a constructor function that accepts all the field values as arguments. Performance-wise, it does not matter.

@kazuho
Copy link
Member
kazuho commented Apr 15, 2019

Do we need consider keeping API stable from now on?

Changing the API is fine if there is a necessity to do so. We prefer moving forward than getting ossified. However, I think we should avoid making excessive changes, because there could be users depending on the current form.

@kazuho kazuho merged commit 8cf3f6c into h2o:master Apr 19, 2019
@kazuho
Copy link
Member
kazuho commented Apr 19, 2019

Thank you for all your work on the PR. Merged.

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