[m-rev.] diff: a more informative message on an abort
Peter Ross
pro at missioncriticalit.com
Wed Mar 23 21:25:44 AEDT 2005
On Wed, Mar 23, 2005 at 11:50:18AM +1100, Zoltan Somogyi wrote:
> runtime/mercury_deep_copy_body.h:
> Generate a more informative message for an abort.
>
> Zoltan.
>
> cvs diff: Diffing .
> Index: mercury_deep_copy_body.h
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
> retrieving revision 1.69
> diff -u -b -r1.69 mercury_deep_copy_body.h
> --- mercury_deep_copy_body.h 14 Dec 2004 01:07:24 -0000 1.69
> +++ mercury_deep_copy_body.h 14 Dec 2004 01:16:57 -0000
> @@ -686,7 +686,16 @@
> **
> ** We don't know how to copy it, so we have to abort.
> */
> - MR_fatal_error("Cannot copy foreign type");
> + char *buf;
> + int len;
> +
> + len = strlen(type_ctor_info->MR_type_ctor_module_name) +
> + strlen(type_ctor_info->MR_type_ctor_name) + 100;
> + buf = (char *) MR_malloc(len);
> + sprintf(buf, "Cannot copy foreign type %s.%s",
> + type_ctor_info->MR_type_ctor_module_name,
> + type_ctor_info->MR_type_ctor_name);
> + MR_fatal_error(buf);
You may want to consider using MR_make_string defined in mercury_string.c
to build formatted strings.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list