Mercurial > urweb
comparison src/c/urweb.c @ 700:db6ab16cd8f3
Initialize contexts a little more vigorously
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 05 Apr 2009 12:05:19 -0400 |
parents | 9b29ce0babb8 |
children | e28637743279 |
comparison
equal
deleted
inserted
replaced
699:4e260887d8f2 | 700:db6ab16cd8f3 |
---|---|
343 | 343 |
344 ctx->n_deltas = ctx->used_deltas = 0; | 344 ctx->n_deltas = ctx->used_deltas = 0; |
345 ctx->deltas = malloc(0); | 345 ctx->deltas = malloc(0); |
346 | 346 |
347 ctx->timeout = uw_timeout; | 347 ctx->timeout = uw_timeout; |
348 | |
349 ctx->client = NULL; | |
350 | |
351 ctx->error_message[0] = 0; | |
348 | 352 |
349 return ctx; | 353 return ctx; |
350 } | 354 } |
351 | 355 |
352 void uw_set_db(uw_context ctx, void *db) { | 356 void uw_set_db(uw_context ctx, void *db) { |
1870 int uw_db_rollback(uw_context); | 1874 int uw_db_rollback(uw_context); |
1871 | 1875 |
1872 void uw_commit(uw_context ctx) { | 1876 void uw_commit(uw_context ctx) { |
1873 unsigned i; | 1877 unsigned i; |
1874 | 1878 |
1875 if (uw_db_commit(ctx)) | 1879 if (uw_db_commit(ctx)) |
1876 uw_error(ctx, FATAL, "Error running SQL COMMIT"); | 1880 uw_error(ctx, FATAL, "Error running SQL COMMIT"); |
1877 | 1881 |
1878 for (i = 0; i < ctx->used_deltas; ++i) { | 1882 for (i = 0; i < ctx->used_deltas; ++i) { |
1879 delta *d = &ctx->deltas[i]; | 1883 delta *d = &ctx->deltas[i]; |
1880 client *c = find_client(d->client); | 1884 client *c = find_client(d->client); |