[m-rev.] diff: clean up CLP(R) interface

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Mar 10 09:22:39 AEDT 2005


On Wed, 9 Mar 2005, Fergus Henderson wrote:

> > +:- pragma foreign_proc("C",
> > +	dump.add_single_string(TheString::in, CLPRString0::in,
> > +		Index::in, CLPRString::out),
> > +	[promise_pure, will_not_call_mercury],
> > +"{
> > +	char *CLPRTmp, *StringTmp;
> > +
> > +	CLPRTmp = (char *) CLPRString0;
> > +	StringTmp = (char *) TheString;
> >
> > +	CLPRString = CLPRString0;
> > +	CLPRTmp += Index;
> > +	while (*StringTmp != '\\0') {
> > +		*CLPRTmp++ = *StringTmp++;
> > +		*CLPRTmp = DUMP_SEPARATOR;
> > +	}
> > +}").
>
> The line "*CLPRTmp = DUMP_SEPARATOR;" got moved from outside of the
> while loop to inside of the while loop.  That looks like a bug to me;
> it won't properly terminate CLPRString in the case when TheString is
> an empty string.
>

Yep, it's a bug.  I've fixed it.

Cheers,
Julien.
--------------------------------------------------------------------------
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