Files
libcoap/examples/coap_list.c
T
Olaf Bergmann 6d7ba61ae0 libcoap-1.pc: fix pkg-config include path
This change excludes the coap subdirectory from the include path
reported by pkg-config --cflags to avoid name conflicts with other
installed packages. Applications now must add the prefix 'coap/'
to include directives for libcoap header files, e.g.

  #include <coap/coap.h>

Jean-Claude Michelou has reported this problem in Bug #82 [1].

[1] https://github.com/obgm/libcoap/issues/82

A minimal Makefile now could look be written as:

  PKG_LIBCOAP=libcoap-1
  CPPFLAGS=$(shell pkg-config --cflags-only-I $(PKG_LIBCOAP)) -DWITH_POSIX
  LDFLAGS=$(shell pkg-config --libs-only-L $(PKG_LIBCOAP))
  LDLIBS=$(shell pkg-config --libs-only-l $(PKG_LIBCOAP))
2017-06-01 12:33:04 +02:00

54 lines
979 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/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);
}
}