Skip to content

Commit 7387ba2

Browse files
committed
synchronized with lua-nginx-module #28cf5ce.
feature: added the FFI API for 'str_replace_char()'.
1 parent df3feb9 commit 7387ba2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/subsys/ngx_subsys_lua_string.c.tt2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,22 @@ ngx_[% subsys %]_lua_ffi_escape_uri(const u_char *src, size_t len, u_char *dst)
764764
NGX_ESCAPE_URI_COMPONENT);
765765
}
766766

767+
768+
[% IF http_subsys %]
769+
void
770+
ngx_[% subsys %]_lua_ffi_str_replace_char(u_char *buf, size_t len,
771+
const u_char find, const u_char replace)
772+
{
773+
while (len) {
774+
if (*buf == find) {
775+
*buf = replace;
776+
}
777+
778+
buf++;
779+
len--;
780+
}
781+
}
782+
[% END %]
767783
#endif
768784

769785
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

0 commit comments

Comments
 (0)