[m-rev.] diff: fix stack overflow on .NET back-end

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Oct 19 20:05:13 AEST 2002


Estimated hours taken: 4
Branches: main

library/string.m:
	Fix a infinite loop bug that showed up on the .NET back-end:
	change Mercury code for the reverse mode of string__to_char_list
	to call string__first_char rather than using string__char_to_string
	and ++.  This is needed because string__char_to_string just calls
	string__to_char_list again.

Workspace: /c/fjh/ws/2/mercury
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.177
diff -u -d -r1.177 string.m
--- library/string.m	16 Oct 2002 15:47:19 -0000	1.177
+++ library/string.m	19 Oct 2002 10:06:30 -0000
@@ -888,7 +888,7 @@
 		Str = ""
 	; CharList = [C | Cs],
 		string__to_char_list(Str0, Cs),
-		Str = string__char_to_string(C) ++ Str0
+		string__first_char(Str, C, Str0)
 	).
 
 :- pred string__to_char_list_2(string::in, int::in, list(char)::uo) is det.
--------------------------------------------------------------------------
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