Commit 8aea90e5 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Replace some impossible cases with assertions.

Noted by Matthieu Boutier.
parent 1e0087be
......@@ -23,6 +23,7 @@ THE SOFTWARE.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
......@@ -60,14 +61,13 @@ add_network(char *ifname, struct network_conf *conf)
{
struct network *net;
if(conf) {
if(strcmp(ifname, conf->ifname) != 0)
return NULL;
}
assert(!conf || strcmp(ifname, conf->ifname) == 0);
FOR_ALL_NETS(net) {
if(strcmp(net->ifname, ifname) == 0)
if(strcmp(net->ifname, ifname) == 0) {
assert(conf == NULL);
return net;
}
}
net = malloc(sizeof(struct network));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment