Commit c8485f8d authored by Per Buer's avatar Per Buer

Nitpicks

parent 5aa97f16
...@@ -210,10 +210,14 @@ Example ...@@ -210,10 +210,14 @@ Example
$Function STRING strstr(STRING, STRING) $Function STRING strstr(STRING, STRING)
Description Description
Returns true if the second string is a substring of the first Returns the substring if the second string is a substring of the first
string. Note that the comparison is case sensitive. You can string. Note that the comparison is case sensitive. You can
use the tolower function on both strings if you want case use the tolower function on both strings if you want case
insensitivity. insensitivity.
If there is no match a NULL pointer is returned which would
evaluate to false in an if-test.
Example Example
if (std.strstr(req.url, req.http.x-restrict)) if (std.strstr(req.url, req.http.x-restrict))
......
...@@ -243,10 +243,11 @@ vmod_cache_req_body(const struct vrt_ctx *ctx, VCL_BYTES size) ...@@ -243,10 +243,11 @@ vmod_cache_req_body(const struct vrt_ctx *ctx, VCL_BYTES size)
VCL_STRING __match_proto__(td_std_strstr) VCL_STRING __match_proto__(td_std_strstr)
vmod_strstr(const struct vrt_ctx *ctx, VCL_STRING mstr, VCL_STRING msubstr) vmod_strstr(const struct vrt_ctx *ctx, VCL_STRING mstr, VCL_STRING msubstr)
{ {
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
char *match = strstr(mstr, msubstr);
return(match); if ((mstr == NULL) || (msubstr == NULL))
return (NULL);
else
return(strstr(mstr, msubstr));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment