-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feature: exposed ngx_http_lua_ffi_str_t for other Nginx modules. #1273
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
|
|
||
| #ifndef _NGX_HTTP_LUA_API_COMMON_H_INCLUDED_ | ||
| #define _NGX_HTTP_LUA_API_COMMON_H_INCLUDED_ | ||
|
|
||
| #include <ngx_core.h> | ||
|
|
||
|
|
||
| #ifndef NGX_LUA_NO_FFI_API | ||
| typedef struct { | ||
| int len; | ||
| /* this padding hole on 64-bit systems is expected */ | ||
| u_char *data; | ||
| } ngx_http_lua_ffi_str_t; | ||
| #endif /* NGX_LUA_NO_FFI_API */ | ||
|
|
||
|
|
||
| #endif /* _NGX_HTTP_LUA_API_COMMON_H_INCLUDED_ */ | ||
|
|
||
| /* vi:set ft=c ts=4 sw=4 et fdm=marker: */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |
| #include <lualib.h> | ||
| #include <lauxlib.h> | ||
|
|
||
| #include "api/ngx_http_lua_api_common.h" | ||
|
|
||
|
|
||
| #if (NGX_PCRE) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's wrong to include
common.hinapi.hsince it exposes allngx_lua's internal types and symbols, which is not desired.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.
@agentzh
No,
ngx_http_lua_api_common.his notngx_http_lua_common.h.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.
@spacewander Why introduce this new
common.hfile? It's confusing ;) Let's simply put everything inside thisapi.h. This file is small anyway.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.
@agentzh
The
ngx_http_lua_ffi_str_tis required inside of the lua-nginx-module too. Put it intoapi.hwill require the other headers to include the public API header. I think it could be more flexible by adding a middle layer.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.
@spacewander Hmm, I disagree here. Internally we should use
ngx_str_tdirectly.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.
@agentzh
ngx_http_lua_ffi_str_tis used inngx_http_lua_util.h:https://github.com/openresty/lua-nginx-module/blob/master/src/ngx_http_lua_util.h#L25
If we put
ngx_http_lua_ffi_str_tintoapi.h, then we should include the public API header into the internal utility header, which is strange.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.
@spacewander I don't want that
api_common.hfile. It's horrible and confusing. You can include the wholeapi.hfile if necessary. I don't mind.