diff src/c/urweb.c @ 1703:6f2f74cc4ead

Change ID generation scheme to conform to HTML standards (thanks to Edward Yang for the catch)
author Adam Chlipala <adam@chlipala.net>
date Fri, 16 Mar 2012 08:42:51 -0400
parents ae22d1fd9b80
children c05e2e4bdde7
line wrap: on
line diff
--- a/src/c/urweb.c	Wed Mar 14 10:10:56 2012 -0400
+++ b/src/c/urweb.c	Fri Mar 16 08:42:51 2012 -0400
@@ -3962,7 +3962,14 @@
 }
 
 uw_Basis_string uw_Basis_fresh(uw_context ctx) {
-  return uw_Basis_htmlifyInt(ctx, ctx->nextId++);
+  int len;
+  char *r;
+
+  uw_check_heap(ctx, 2+INTS_MAX);
+  r = ctx->heap.front;
+  sprintf(r, "uw%u%n", ctx->nextId++, &len);
+  ctx->heap.front += len+1;
+  return r;
 }
 
 uw_Basis_float uw_Basis_floatFromInt(uw_context ctx, uw_Basis_int n) {