Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
827:497c7dbcc695 | 828:14a6c0971d89 |
---|---|
1805 return &s[n]; | 1805 return &s[n]; |
1806 else | 1806 else |
1807 uw_error(ctx, FATAL, "Out-of-bounds strsuffix"); | 1807 uw_error(ctx, FATAL, "Out-of-bounds strsuffix"); |
1808 } | 1808 } |
1809 | 1809 |
1810 uw_Basis_int uw_Basis_strlen(uw_context ctx, uw_Basis_string s) { | |
1811 return strlen(s); | |
1812 } | |
1813 | |
1810 uw_Basis_string uw_Basis_strcat(uw_context ctx, uw_Basis_string s1, uw_Basis_string s2) { | 1814 uw_Basis_string uw_Basis_strcat(uw_context ctx, uw_Basis_string s1, uw_Basis_string s2) { |
1811 int len = strlen(s1) + strlen(s2) + 1; | 1815 int len = uw_Basis_strlen(ctx, s1) + uw_Basis_strlen(ctx, s2) + 1; |
1812 char *s; | 1816 char *s; |
1813 | 1817 |
1814 uw_check_heap(ctx, len); | 1818 uw_check_heap(ctx, len); |
1815 | 1819 |
1816 s = ctx->heap.front; | 1820 s = ctx->heap.front; |
1821 | 1825 |
1822 return s; | 1826 return s; |
1823 } | 1827 } |
1824 | 1828 |
1825 uw_Basis_string uw_strdup(uw_context ctx, uw_Basis_string s1) { | 1829 uw_Basis_string uw_strdup(uw_context ctx, uw_Basis_string s1) { |
1826 int len = strlen(s1) + 1; | 1830 int len = uw_Basis_strlen(ctx, s1) + 1; |
1827 char *s; | 1831 char *s; |
1828 | 1832 |
1829 uw_check_heap(ctx, len); | 1833 uw_check_heap(ctx, len); |
1830 | 1834 |
1831 s = ctx->heap.front; | 1835 s = ctx->heap.front; |