Fixed a few mistakes.

This commit is contained in:
Nicolás A. Ortega 2017-07-13 21:56:19 +02:00
parent 655350bf25
commit 0ee5cb8793
No known key found for this signature in database
GPG Key ID: 3D786FB3123FF1DD

View File

@ -26,12 +26,16 @@
#include <assert.h>
int NeoComm_init_nodes(unsigned int max_nodes) {
if(max_nodes != 0)
return 1;
// If we want 0 nodes then don't initialize, give error if
// already initialized
if(max_nodes == 0 || node_max != 0)
return 0;
node_list = calloc(max_nodes, sizeof(struct NeoComm_node));
if(!node_list)
return 0;
// Set to NULL to check for free spots
for(unsigned int i = 0; i < max_nodes; ++i)
node_list[i].address.address = NULL;