diff src/c/urweb.c @ 828:14a6c0971d89

String.length
author Adam Chlipala <adamc@hcoop.net>
date Sat, 30 May 2009 09:59:10 -0400
parents 395a5d450cc0
children 20fe00fd81da
line wrap: on
line diff
--- a/src/c/urweb.c	Thu May 28 13:47:05 2009 -0400
+++ b/src/c/urweb.c	Sat May 30 09:59:10 2009 -0400
@@ -1807,8 +1807,12 @@
     uw_error(ctx, FATAL, "Out-of-bounds strsuffix");
 }
 
+uw_Basis_int uw_Basis_strlen(uw_context ctx, uw_Basis_string s) {
+  return strlen(s);
+}
+
 uw_Basis_string uw_Basis_strcat(uw_context ctx, uw_Basis_string s1, uw_Basis_string s2) {
-  int len = strlen(s1) + strlen(s2) + 1;
+  int len = uw_Basis_strlen(ctx, s1) + uw_Basis_strlen(ctx, s2) + 1;
   char *s;
 
   uw_check_heap(ctx, len);
@@ -1823,7 +1827,7 @@
 }
 
 uw_Basis_string uw_strdup(uw_context ctx, uw_Basis_string s1) {
-  int len = strlen(s1) + 1;
+  int len = uw_Basis_strlen(ctx, s1) + 1;
   char *s;
 
   uw_check_heap(ctx, len);