[master] ddfda3d7c clarify that vmod return values are immutable
Nils Goroll
nils.goroll at uplex.de
Thu Oct 25 14:06:09 UTC 2018
commit ddfda3d7c996e67a1894fc3955eb546ebd0b721b
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Thu Oct 25 16:03:28 2018 +0200
clarify that vmod return values are immutable
diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst
index 8978ca4f2..46ad29d5d 100644
--- a/doc/sphinx/reference/vmod.rst
+++ b/doc/sphinx/reference/vmod.rst
@@ -268,6 +268,16 @@ language representation. Here is a description of them.
All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL,
etc.
+Notice that all the non-native (C pointer) types are ``const``, so
+anything returned by a vmod function/method is assumed to be
+immutable. In other words, a vmod `must not` modify any data which was
+previously returned.
+
+When returning non-native values, the producing function is
+responsible for arranging memory management. Either by freeing the
+structure later by whatever means available or by using storage
+allocated from the client or backend workspaces.
+
ACL
C-type: ``const struct vrt_acl *``
@@ -376,12 +386,6 @@ STRING
If there were no "foobar" HTTP header, the vmod_foo()
function would be passed a NULL pointer as argument.
- When used as a return value, the producing function is
- responsible for arranging memory management. Either by
- freeing the string later by whatever means available or
- by using storage allocated from the client or backend
- workspaces.
-
STEVEDORE
C-type: ``const struct stevedore *``
More information about the varnish-commit
mailing list