Commit 900f7e11 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify find_destination.

parent 1315ceac
...@@ -47,20 +47,17 @@ find_destination(const unsigned char *d, int create, unsigned char seqno) ...@@ -47,20 +47,17 @@ find_destination(const unsigned char *d, int create, unsigned char seqno)
if(!create) if(!create)
return NULL; return NULL;
if(i >= numdests) { if(numdests >= MAXDESTS) {
if(numdests >= MAXDESTS) { fprintf(stderr, "Too many destinations.\n");
fprintf(stderr, "Too many destinations.\n"); return NULL;
return NULL;
}
memcpy(dests[numdests].address, d, 16);
numdests++;
} }
dests[i].seqno = seqno; memcpy(dests[numdests].address, d, 16);
dests[i].metric = INFINITY; dests[numdests].seqno = seqno;
dests[i].time = now.tv_sec; dests[numdests].metric = INFINITY;
dests[i].requested_seqno = -1; dests[numdests].time = now.tv_sec;
dests[i].requested_net = NULL; dests[numdests].requested_seqno = -1;
return &dests[i]; dests[numdests].requested_net = NULL;
return &dests[numdests++];
} }
void void
......
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