aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-registry
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-08 18:14:54 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-08 18:14:54 +0100
commita45a3204a0b093d6899249b18808692e3f8ac863 (patch)
tree8922112c324fda189a0571fd1bcc2685d21a1474 /src/mds-registry
parentwhenever fail_if gotos to the failure clause, print whence (diff)
downloadmds-a45a3204a0b093d6899249b18808692e3f8ac863.tar.gz
mds-a45a3204a0b093d6899249b18808692e3f8ac863.tar.bz2
mds-a45a3204a0b093d6899249b18808692e3f8ac863.tar.xz
replace all goto pfail with fail_if, so that we can take whence it failed
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-registry/mds-registry.c4
-rw-r--r--src/mds-registry/registry.c10
2 files changed, 6 insertions, 8 deletions
diff --git a/src/mds-registry/mds-registry.c b/src/mds-registry/mds-registry.c
index 741423c..8b2a3e5 100644
--- a/src/mds-registry/mds-registry.c
+++ b/src/mds-registry/mds-registry.c
@@ -175,8 +175,8 @@ int master_loop(void)
}
else if (errno == EINTR)
continue;
- else if (errno != ECONNRESET)
- goto pfail;
+ else
+ fail_if (errno != ECONNRESET);
eprint("lost connection to server.");
mds_message_destroy(&received);
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index 2d0643f..89f1d80 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -132,8 +132,7 @@ static int registry_action_add(int has_key, char* command, size_t command_key, u
/* Add server to protocol if the protocol is already in the table. */
size_t address = hash_table_get(&reg_table, command_key);
client_list_t* list = (client_list_t*)(void*)address;
- if (client_list_add(list, client) < 0)
- goto pfail;
+ fail_if (client_list_add(list, client) < 0);
}
else
{
@@ -142,13 +141,12 @@ static int registry_action_add(int has_key, char* command, size_t command_key, u
/* Allocate list of servers for the protocol. */
client_list_t* list = malloc(sizeof(client_list_t));
void* address = list;
- if (list == NULL)
- goto pfail;
+ fail_if (list == NULL);
/* Duplicate the protocol name so it can be accessed later. */
if ((command = strdup(command)) == NULL)
{
free(list);
- goto pfail;
+ fail_if (1);
}
/* Create list of servers, add server to list and add the protocol to the table. */
command_key = (size_t)(void*)command;
@@ -159,7 +157,7 @@ static int registry_action_add(int has_key, char* command, size_t command_key, u
client_list_destroy(list);
free(list);
free(command);
- goto pfail;
+ fail_if (1);
}
}