-
Notifications
You must be signed in to change notification settings - Fork 845
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
Conversation
Not sure about the ci error, Issue in test code??
|
There was a problem hiding this 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.
include/h2o/header.h
Outdated
@@ -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); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
lib/core/headers.c
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
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. |
Thank you for all your work on the PR. Merged. |
This PR trying clean up some code for 'lib/core/headers.c'