[m-dev.] diff: move the initialisation of MR_mmc_options in MR_trace_event_external()

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 26 13:05:08 AEST 1999


On 25-May-1999, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
> Initialise the variable MR_mmc_options in MR_trace_init_external() rather 
> than in MR_trace_event_external().
> 
> trace/mercury_trace_external.c:
> 	Move the call to 
> 	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options))
> 	from MR_trace_event_external() to MR_trace_init_external().

The log message should explain the rationale for the change.

> +++ mercury_trace_external.c	1999/05/25 08:17:37
> @@ -213,6 +213,14 @@
>  	struct sockaddr* addr;
>  	Word debugger_request;
>  	Integer debugger_request_type;
> +	static String	MR_mmc_options;
> +
> +	/* 
> +	** MR_mmc_options contains the options to pass to mmc when compiling 
> +	** queries. We initialise it to the String "".
> +	*/
> +
> +	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
>  
>  	/*
>  	** We presume that the user's program has been invoked from
> @@ -401,13 +409,7 @@
>  	Integer		modules_list_length;
>  	Word		modules_list;
>  	int		ancestor_level;
> -
> -	/* 
> -	** MR_mmc_options contains the options to pass to mmc when compiling 
> -	** queries. We initialise it to the String "".
> -	*/
> -	static String	MR_mmc_options;
> -	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
> +        static String	MR_mmc_options;
>  
>  	/* by default, print variables from the current call */
>  	ancestor_level = 0;

The two different declarations of MR_mmc_options in different functions
each define a different variable.  So the variable that gets initialized
is not the same as the variable that gets used.  You need to make the
declaration of MR_mmc_options global to that C file.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list