mirror of https://git.48k.eu/ogserver
rest: remove dead code in /repository/add
Remove unused code in this request and do not assume center id.master
parent
fc0f19fe30
commit
9c69f112de
30
src/rest.c
30
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue