[PATCH 1 of 2] revlog: explicitly initialize static variables

Gregory Szorc gregory.szorc at gmail.com
Tue Oct 9 11:06:05 EDT 2018


On Tue, Oct 9, 2018 at 6:00 AM Yuya Nishihara <yuya at tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1539038525 -32400
> #      Tue Oct 09 07:42:05 2018 +0900
> # Node ID fec6a0498695298ec0507a76cd26334794da93be
> # Parent  8a08aefa9273e6f328f238e4793f9a43f314e471
> revlog: explicitly initialize static variables
>

Queued, thanks.


>
> I know .bss section is zero-filled, but explicit initialization should be
> better as we rely on that.
>
> diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
> --- a/mercurial/cext/revlog.c
> +++ b/mercurial/cext/revlog.c
> @@ -94,8 +94,8 @@ static Py_ssize_t index_length(const ind
>         return self->length + PyList_GET_SIZE(self->added);
>  }
>
> -static PyObject *nullentry;
> -static const char nullid[20];
> +static PyObject *nullentry = NULL;
> +static const char nullid[20] = {0};
>
>  static Py_ssize_t inline_scan(indexObject *self, const char **offsets);
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20181009/cd05fb18/attachment.html>


More information about the Mercurial-devel mailing list