engine_control/source/firmware/kernel/list.c
tkl 4eaea0c98b - folder structure reordered
- unnecessary drivers removed
2016-07-27 14:47:22 +02:00

37 lines
487 B
C

/*
* list.c
*
* Created on: Jul 27, 2016
* Author: tkl
*/
#include "stddef.h"
#include "list.h"
int list_init(struct list *head)
{
if(NULL == head)
return -1;
head->front = NULL;
head->rear = NULL;
return 0;
}
int list_add(struct list *head, struct list_node *node)
{
if((NULL == head) || (NULL == node))
return -1;
if(head->front == NULL) {
head->front = node;
head->rear = node;
}
else {
head->rear->next = node;
head->rear = node;
}
return 1;
}