X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=common%2Fapp.c;h=27dfb5fd881759c035a77bd43295802bc487fff4;hb=db45aeacb003f72b853abbccd6f722770732438b;hp=9bc4e4006dec5dfe2ffc217f29d67c30ddf33cac;hpb=3d27274b36b44816c736ea8a411341b5a36556f9;p=blerg.git diff --git a/common/app.c b/common/app.c index 9bc4e40..27dfb5f 100644 --- a/common/app.c +++ b/common/app.c @@ -1,7 +1,9 @@ +/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a + * BSD-style license. Please see the COPYING file for details. + */ #include #include #include -#include #include "app.h" int parse_url_info(const char *url, struct url_info *info) { @@ -48,31 +50,3 @@ uint64_t *make_sequential_list(uint64_t from, uint64_t to) { return list; } - -void json_generate_one_record(yajl_gen g, const char *author, struct blerg *b, uint64_t record) { - char *data; - char number[21]; - int len; - - if (!blerg_fetch(b, record, &data, &len)) { - fprintf(stderr, "Could not fetch record\n"); - return; - } - - yajl_gen_map_open(g); - if (author != NULL) { - yajl_gen_string(g, "author", 6); - yajl_gen_string(g, author, strlen(author)); - } - yajl_gen_string(g, "record", 6); - snprintf(number, 21, "%llu", record); - yajl_gen_string(g, number, strlen(number)); - yajl_gen_string(g, "timestamp", 9); - yajl_gen_integer(g, blerg_get_timestamp(b, record)); - yajl_gen_string(g, "data", 4); - yajl_gen_string(g, data, len); - yajl_gen_map_close(g); - - free(data); -} -