Added asserts.
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
int NeoComm_init_nodes(unsigned int max_nodes) {
|
||||
if(max_nodes == 0)
|
||||
@ -70,6 +71,7 @@ unsigned int NeoComm_get_node_count() {
|
||||
}
|
||||
|
||||
struct node *NeoComm_add_node(struct address addr) {
|
||||
assert(node_list);
|
||||
if(node_count >= node_max)
|
||||
return NULL;
|
||||
for(unsigned int i = 0; i < node_max; ++i)
|
||||
@ -96,6 +98,7 @@ struct node *NeoComm_add_node(struct address addr) {
|
||||
}
|
||||
|
||||
int NeoComm_remove_node(struct address addr) {
|
||||
assert(node_list);
|
||||
int removed = 0;
|
||||
for(unsigned int i = 0; i < node_max; ++i)
|
||||
{
|
||||
@ -115,6 +118,7 @@ int NeoComm_remove_node(struct address addr) {
|
||||
}
|
||||
|
||||
struct node *NeoComm_get_node(struct address addr) {
|
||||
assert(node_list);
|
||||
for(unsigned int i = 0; i < node_max; ++i)
|
||||
{
|
||||
if(strcmp(node_list[i].address.address, addr.address) == 0 &&
|
||||
|
Reference in New Issue
Block a user