projects
/
blerg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2682300
)
Fix empty response for empty accounts
author
Chip Black
<bytex64@bytex64.net>
Fri, 24 Dec 2010 05:50:24 +0000
(23:50 -0600)
committer
Chip Black
<bytex64@bytex64.net>
Fri, 24 Dec 2010 05:50:24 +0000
(23:50 -0600)
http_blerg.c
patch
|
blob
|
history
diff --git
a/http_blerg.c
b/http_blerg.c
index
a73ac1e
..
9078f53
100644
(file)
--- a/
http_blerg.c
+++ b/
http_blerg.c
@@
-203,17
+203,13
@@
struct MHD_Response *create_response_for_range(struct blerg *b, uint64_t from, u
return NULL;
}
return NULL;
}
- if (record_count == 0) {
- response = MHD_create_response_from_data(2, "[]", MHD_NO, MHD_NO);
- } else {
- gs->entries = make_sequential_list(from, to);
- gs->i = to - from;
+ gs->entries = make_sequential_list(from, to);
+ gs->i = to - from;
-
gs->g = yajl_gen_alloc(&yajl_c, NULL);
-
gs->yoff = gs->done = 0;
+ gs->g = yajl_gen_alloc(&yajl_c, NULL);
+ gs->yoff = gs->done = 0;
- response = MHD_create_response_from_callback(-1, 262144, &GET_generate_list, gs, &GET_generate_list_free);
- }
+ response = MHD_create_response_from_callback(-1, 262144, &GET_generate_list, gs, &GET_generate_list_free);
return response;
}
return response;
}
@@
-262,7
+258,7
@@
ahc_derp (void *cls, struct MHD_Connection *connection, const char *url, const c
uint64_t record_count, from, to;
record_count = blerg_get_record_count(b);
if (record_count == 0) {
uint64_t record_count, from, to;
record_count = blerg_get_record_count(b);
if (record_count == 0) {
- response =
create_response_for_range(b, 0, 0
);
+ response =
MHD_create_response_from_data(2, "[]", MHD_NO, MHD_NO
);
} else {
to = record_count - 1;
from = (record_count > 50 ? to - 49 : 0);
} else {
to = record_count - 1;
from = (record_count > 50 ? to - 49 : 0);