diff options
author | Franklin Wei <me@fwei.tk> | 2018-07-18 23:37:45 -0400 |
---|---|---|
committer | Franklin Wei <me@fwei.tk> | 2018-07-18 23:37:45 -0400 |
commit | 75e5bf09506412ac679d60dc051f97d99d24702d (patch) | |
tree | 67de107d7a39ffee14aaec877eb245eca44e3c07 /client.c | |
parent | dc5df5430888f2ff4054d87086f0f8d3689af644 (diff) | |
download | csaa-75e5bf09506412ac679d60dc051f97d99d24702d.zip csaa-75e5bf09506412ac679d60dc051f97d99d24702d.tar.gz csaa-75e5bf09506412ac679d60dc051f97d99d24702d.tar.bz2 csaa-75e5bf09506412ac679d60dc051f97d99d24702d.tar.xz |
Add a compile-time option to do database prepopulation and exit
Enabling the PREPOPULATE macro in service_provider.c will cause it to
initialize a database with 2^logleaves - RUNS_TEST files, and exit. This
allows fast testing on the resulting database at near full load.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -550,30 +550,6 @@ int connect_to_service(const char *sockpath) return fd; } -void *load_file(const char *path, size_t *len) -{ - if(!path) - return NULL; - - FILE *f = fopen(path, "r"); - fseek(f, 0, SEEK_END); - *len = ftell(f); - fseek(f, 0, SEEK_SET); - void *buf = malloc(*len); - fread(buf, 1, *len, f); - return buf; -} - -void write_file(const char *path, const void *contents, size_t len) -{ - if(contents) - { - FILE *f = fopen(path, "w"); - fwrite(contents, 1, len, f); - fclose(f); - } -} - bool server_request(const char *sockpath, const char *user_key, uint64_t user_id, struct user_request req, |