Mercurial > urweb
comparison src/c/lacweb.c @ 183:c0ea24dcb86f
Optimizing 'case' in Mono_reduce
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 03 Aug 2008 13:30:27 -0400 |
parents | c7a5c8e0a0e0 |
children | 88d46972de53 |
comparison
equal
deleted
inserted
replaced
182:d11754ffe252 | 183:c0ea24dcb86f |
---|---|
190 memcpy(ctx->page_front, s, len); | 190 memcpy(ctx->page_front, s, len); |
191 ctx->page_front += len; | 191 ctx->page_front += len; |
192 } | 192 } |
193 | 193 |
194 void lw_write(lw_context ctx, const char* s) { | 194 void lw_write(lw_context ctx, const char* s) { |
195 lw_check(ctx, strlen(s)); | 195 lw_check(ctx, strlen(s) + 1); |
196 lw_write_unsafe(ctx, s); | 196 lw_write_unsafe(ctx, s); |
197 *ctx->page_front = 0; | |
197 } | 198 } |
198 | 199 |
199 | 200 |
200 #define INTS_MAX 50 | 201 #define INTS_MAX 50 |
201 #define FLOATS_MAX 100 | 202 #define FLOATS_MAX 100 |
508 | 509 |
509 lw_Basis_string lw_Basis_strcat(lw_context ctx, lw_Basis_string s1, lw_Basis_string s2) { | 510 lw_Basis_string lw_Basis_strcat(lw_context ctx, lw_Basis_string s1, lw_Basis_string s2) { |
510 int len = strlen(s1) + strlen(s2) + 1; | 511 int len = strlen(s1) + strlen(s2) + 1; |
511 char *s; | 512 char *s; |
512 | 513 |
513 lw_check(ctx, len); | 514 printf("s1 = %s\ns2 = %s\n", s1, s2); |
515 | |
516 lw_check_heap(ctx, len); | |
514 | 517 |
515 s = ctx->heap_front; | 518 s = ctx->heap_front; |
516 | 519 |
517 strcpy(s, s1); | 520 strcpy(s, s1); |
518 strcat(s, s2); | 521 strcat(s, s2); |
519 ctx->heap_front += len; | 522 ctx->heap_front += len; |
520 | 523 |
524 printf("s = %s\n", s); | |
525 | |
521 return s; | 526 return s; |
522 } | 527 } |