summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/rest.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/rest.c b/src/rest.c
index 6b361d5..b479b75 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -5400,18 +5400,13 @@ static int og_cmd_post_repository_add(json_t *element,
struct og_msg_params *params,
char *buffer_reply)
{
- struct og_buffer og_buffer = {
- .data = buffer_reply,
- };
- struct og_repository repo = {
- .center = 1,
- };
+ struct og_repository repo = {};
const char *key, *msglog;
- json_t *value, *root;
struct in_addr addr;
struct og_dbi *dbi;
dbi_result result;
- int err = 0, id;
+ json_t *value;
+ int err = 0;
json_object_foreach(element, key, value) {
if (!strcmp(key, "name")) {
@@ -5464,25 +5459,6 @@ static int og_cmd_post_repository_add(json_t *element,
return -1;
}
- root = json_object();
- if (!root) {
- syslog(LOG_ERR, "Cannot allocate JSON object (%s:%d)\n",
- __func__, __LINE__);
- dbi_result_free(result);
- og_dbi_close(dbi);
- return -1;
- }
- id = dbi_conn_sequence_last(dbi->conn, NULL);
- json_object_set_new(root, "id", json_integer(id));
- json_object_set_new(root, "ip", json_string(repo.ip));
- json_object_set_new(root, "name", json_string(repo.name));
- json_object_set_new(root, "center", json_integer(repo.center));
- if (json_dump_callback(root, og_json_dump_clients, &og_buffer, 0)) {
- json_decref(root);
- return -1;
- }
-
- json_decref(root);
dbi_result_free(result);
og_dbi_close(dbi);