mirror of
https://github.com/obgm/libcoap.git
synced 2026-10-31 23:15:48 +03:00
55 lines
1005 B
C
55 lines
1005 B
C
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 * -*- */
|
|
|
|
/* coap_list.c -- CoAP list structures
|
|
*
|
|
* Copyright (C) 2010,2011,2015 Olaf Bergmann <bergmann@tzi.org>
|
|
*
|
|
* This file is part of the CoAP library libcoap. Please see README for terms of
|
|
* use.
|
|
*/
|
|
|
|
/* #include "coap_config.h" */
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <coap/libcoap.h>
|
|
#include <coap/debug.h>
|
|
#include <coap/mem.h>
|
|
#include "coap_list.h"
|
|
|
|
|
|
int
|
|
coap_insert(coap_list_t **head, coap_list_t *node) {
|
|
if (!node) {
|
|
coap_log(LOG_WARNING, "cannot create option Proxy-Uri\n");
|
|
} else {
|
|
/* must append at the list end to avoid re-ordering of
|
|
* options during sort */
|
|
LL_APPEND((*head), node);
|
|
}
|
|
|
|
return node != NULL;
|
|
}
|
|
|
|
int
|
|
coap_delete(coap_list_t *node) {
|
|
if (node) {
|
|
coap_free(node);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
void
|
|
coap_delete_list(coap_list_t *queue) {
|
|
coap_list_t *elt, *tmp;
|
|
|
|
if (!queue)
|
|
return;
|
|
|
|
LL_FOREACH_SAFE(queue, elt, tmp) {
|
|
coap_delete(elt);
|
|
}
|
|
}
|
|
|