[m-rev.] for post-commit review: fix a bug in deconstructing foreign types

Peter Wang novalazy at gmail.com
Thu Jun 11 10:20:24 AEST 2015


On Wed, 10 Jun 2015 12:28:17 +0200 (CEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> A minor fix.
> 

> diff --git a/runtime/mercury_deconstruct.c b/runtime/mercury_deconstruct.c
> index 364158c..f45ace4 100644
> --- a/runtime/mercury_deconstruct.c
> +++ b/runtime/mercury_deconstruct.c
> @@ -20,6 +20,15 @@
>  #include "mercury_type_desc.h"
>  #include "mercury_minimal_model.h"
>  
> +/*
> +** We reserve a static buffer to hold the names we dynamically generate
> +** for "functors" of foreign types. This should eliminate the possibility
> +** that the space we used to reserve on the stack for this may clobber
> +** other information there.
> +*/
> +#define MR_FOREIGN_NAME_BUF_SIZE    256
> +static  char            MR_foreign_functor_name_buf[MR_FOREIGN_NAME_BUF_SIZE];

It is not thread-safe, though.

Peter



More information about the reviews mailing list