Added asserts.

This commit is contained in:
Nicolás A. Ortega
2017-07-03 18:50:46 +02:00
parent 97422a068d
commit 12abd12936
2 changed files with 5 additions and 1 deletions

View File

@ -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 &&