[master] 5dd049418 First step to vmod code maintenance automation

Dridi Boukelmoune dridi at varni.sh
Mon Apr 15 16:04:34 UTC 2019


On Mon, Apr 15, 2019 at 5:17 PM Nils Goroll <nils.goroll at uplex.de> wrote:
>
>
> commit 5dd049418a4edf34d96f18fd1cb66c0893593fc6
> Author: Nils Goroll <nils.goroll at uplex.de>
> Date:   Mon Apr 15 17:15:14 2019 +0200
>
>     First step to vmod code maintenance automation
>
> diff --git a/coccinelle/README.rst b/coccinelle/README.rst
> new file mode 100644
> index 000000000..f279cb563
> --- /dev/null
> +++ b/coccinelle/README.rst

Shouldn't we move this to tools/coccinelle?

I will check in my spatches too.

> @@ -0,0 +1,10 @@
> +This directory contains `coccinelle`_ patches to facilitate code
> +maintenance.
> +
> +Each patch should, in a comment section, explain its purpose.
> +
> +Unless noted otherwise, all patches should work when invoked as::
> +
> +       spatch --dir . --in-place --sp-file $COCCI
> +
> +.. _coccinelle: http://coccinelle.lip6.fr/
> diff --git a/coccinelle/vmod/WS_Reserve.cocci b/coccinelle/vmod/WS_Reserve.cocci
> new file mode 100644
> index 000000000..f40a49dbb
> --- /dev/null
> +++ b/coccinelle/vmod/WS_Reserve.cocci
> @@ -0,0 +1,23 @@
> +/*
> + * patch to change code with respect to #2969: Replacement of
> + * WS_Reserve(ws, sz) by WS_ReserveAll(ws) / WS_ReserveSize(ws, sz)
> + *
> + * NOTE this patch does not check/fix error handling:
> + * - WS_ReserveAll(ws) : Always needs WS_Release(ws, sz)
> + * - WS_ReserveSize(ws, sz): needs WS_Release(ws, sz) if retval != 0
> + */
> +@@
> +expression ws;
> +identifier ptr;
> +@@
> +
> +-ptr = WS_Reserve(ws, 0);
> ++ptr = WS_ReserveAll(ws);
> +
> +@@
> +expression ws, sz;
> +identifier ptr;
> +@@
> +
> +-ptr = WS_Reserve(ws, sz);
> ++ptr = WS_ReserveSize(ws, sz);
> diff --git a/doc/changes.rst b/doc/changes.rst
> index e7666d0c7..294fb8e80 100644
> --- a/doc/changes.rst
> +++ b/doc/changes.rst
> @@ -60,7 +60,8 @@ C APIs (for vmod and utility authors)
>      It will only leave the workspace reserved if the reservation
>      request could be fulfilled.
>
> -
> +  We provide a script to automate this change in the ``coccinelle``
> +  subdirectory of the source tree.
>
>  ================================
>  Varnish Cache 6.2.0 (2019-03-15)
> _______________________________________________
> varnish-commit mailing list
> varnish-commit at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit


More information about the varnish-commit mailing list