Fixed a few mistakes.
This commit is contained in:
parent
655350bf25
commit
0ee5cb8793
@ -26,12 +26,16 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
int NeoComm_init_nodes(unsigned int max_nodes) {
|
int NeoComm_init_nodes(unsigned int max_nodes) {
|
||||||
if(max_nodes != 0)
|
// If we want 0 nodes then don't initialize, give error if
|
||||||
return 1;
|
// already initialized
|
||||||
|
if(max_nodes == 0 || node_max != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
node_list = calloc(max_nodes, sizeof(struct NeoComm_node));
|
node_list = calloc(max_nodes, sizeof(struct NeoComm_node));
|
||||||
if(!node_list)
|
if(!node_list)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Set to NULL to check for free spots
|
||||||
for(unsigned int i = 0; i < max_nodes; ++i)
|
for(unsigned int i = 0; i < max_nodes; ++i)
|
||||||
node_list[i].address.address = NULL;
|
node_list[i].address.address = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user