comparison src/c/urweb.c @ 645:1b571a05874c

React demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Mar 2009 11:18:01 -0400
parents aa2290c32ce2
children 5130228d2b29
comparison
equal deleted inserted replaced
644:8e17e6b615bd 645:1b571a05874c
380 uw_check_script(ctx, len + 1); 380 uw_check_script(ctx, len + 1);
381 strcpy(ctx->script_front, s); 381 strcpy(ctx->script_front, s);
382 ctx->script_front += len; 382 ctx->script_front += len;
383 } 383 }
384 384
385 char *uw_Basis_get_script(uw_context ctx, uw_unit u) { 385 const char *uw_Basis_get_script(uw_context ctx, uw_unit u) {
386 if (ctx->script_front == ctx->script) { 386 if (ctx->script_front == ctx->script) {
387 char *r = uw_malloc(ctx, 1); 387 return ctx->script_header;
388 r[0] = 0;
389 return r;
390 } else { 388 } else {
391 char *r = uw_malloc(ctx, 41 + (ctx->script_front - ctx->script) + strlen(ctx->script_header)); 389 char *r = uw_malloc(ctx, 41 + (ctx->script_front - ctx->script) + strlen(ctx->script_header));
392 390
393 sprintf(r, "%s<script>%s</script>", ctx->script_header, ctx->script); 391 sprintf(r, "%s<script>%s</script>", ctx->script_header, ctx->script);
394 return r; 392 return r;