Added documentation.
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
#include "nodes.h"
|
||||
|
||||
// List of nodes
|
||||
extern struct node *node_list;
|
||||
extern struct NeoComm_node *node_list;
|
||||
// Maximum number of nodes
|
||||
extern unsigned int node_max;
|
||||
// Number of nodes in the list
|
||||
|
11
src/nodes.c
11
src/nodes.c
@ -28,7 +28,7 @@
|
||||
int NeoComm_init_nodes(unsigned int max_nodes) {
|
||||
if(max_nodes == 0)
|
||||
return 1;
|
||||
node_list = calloc(max_nodes, sizeof(struct node));
|
||||
node_list = calloc(max_nodes, sizeof(struct NeoComm_node));
|
||||
if(!node_list)
|
||||
return 0;
|
||||
|
||||
@ -53,7 +53,8 @@ int NeoComm_resize_node_list(unsigned int new_max_nodes) {
|
||||
if(new_max_nodes <= node_max)
|
||||
return 0;
|
||||
|
||||
void* tmp_list = realloc(node_list, new_max_nodes * sizeof(struct node));
|
||||
void* tmp_list =
|
||||
realloc(node_list, new_max_nodes * sizeof(struct NeoComm_node));
|
||||
if(!tmp_list)
|
||||
return 0;
|
||||
|
||||
@ -70,7 +71,7 @@ unsigned int NeoComm_get_node_count() {
|
||||
return node_count;
|
||||
}
|
||||
|
||||
struct node *NeoComm_add_node(struct address addr) {
|
||||
struct NeoComm_node *NeoComm_add_node(struct NeoComm_address addr) {
|
||||
assert(node_list);
|
||||
if(node_count >= node_max)
|
||||
return NULL;
|
||||
@ -97,7 +98,7 @@ struct node *NeoComm_add_node(struct address addr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int NeoComm_remove_node(struct address addr) {
|
||||
int NeoComm_remove_node(struct NeoComm_address addr) {
|
||||
assert(node_list);
|
||||
int removed = 0;
|
||||
for(unsigned int i = 0; i < node_max; ++i)
|
||||
@ -117,7 +118,7 @@ int NeoComm_remove_node(struct address addr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct node *NeoComm_get_node(struct address addr) {
|
||||
struct NeoComm_node *NeoComm_get_node(struct NeoComm_address addr) {
|
||||
assert(node_list);
|
||||
for(unsigned int i = 0; i < node_max; ++i)
|
||||
{
|
||||
|
Reference in New Issue
Block a user