Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@chenbd
Copy link
Contributor

@chenbd chenbd commented Mar 16, 2019

According to Issues #2006
The fix focus on lib directory in the source tree.

Library uses can define this macro to something else to use their log function.

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 the PR.

Could the macro be named H2O_ERROR_PRINTF? Reasons:

  • It would be preferable to consistently use H2O_ as a prefix. With the change, it becomes less counter-intuitive to use the macro from source files dedicated to the standalone server.
  • Having "printf" as part of the name of the macro better implies that the arguments are in printf-style.

@chenbd
Copy link
Contributor Author

chenbd commented Mar 16, 2019

@kazuho Fixed.

@chenbd chenbd force-pushed the libh2o_fprintf_stderr branch 2 times, most recently from 57a0ceb to 8b42567 Compare March 18, 2019 12:57
@kazuho
Copy link
Member

kazuho commented Mar 18, 2019

Thank you for the changes. Re perror I think we need to create ah2o_perror function that wraps H2O_ERROR_PRINTF and strerror_r, because strerror is not thread-safe, while perror is.

@kazuho
Copy link
Member

kazuho commented Mar 18, 2019

PS. Other than that the PR looks good to me. Please let me know when you think the work is done.

@chenbd chenbd force-pushed the libh2o_fprintf_stderr branch from 8b42567 to 039030f Compare March 18, 2019 14:58
@chenbd
Copy link
Contributor Author

chenbd commented Mar 18, 2019

Thank you for the changes. Re perror I think we need to create ah2o_perror function that wraps H2O_ERROR_PRINTF and strerror_r, because strerror is not thread-safe, while perror is.

@kazuho Fixed, please review.

@chenbd chenbd changed the title add 'libh2o_error' macro, default is 'fprintf(stderr,...)' add 'H2O_ERROR_PRINTF' macro, default is 'fprintf(stderr,...)' Mar 19, 2019
@kazuho kazuho merged commit 039030f into h2o:master Mar 29, 2019
kazuho added a commit that referenced this pull request Mar 29, 2019
add 'H2O_ERROR_PRINTF' macro, default is 'fprintf(stderr,...)'
@kazuho
Copy link
Member

kazuho commented Mar 29, 2019

Thank you for the changes.

I now realize that H2O_ERROR_PRINTF should better be in lowercase, because there is no reason to exclaim that it is currently defined as a macro inside libh2o, and because it resolves the inconsistency between h2o_perror (which is lowercase).

Therefore made the changes then merged to master.

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