From db79086c67a1db7c200a4cb81b52851c442d92c5 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Tue, 8 Jun 2021 15:26:52 +0200 Subject: [PATCH] Cleanup: Remove unused header file bits.h The functions in bits.h have not been used anymore and can be removed. --- Makefile.am | 1 - include/coap3/bits.h | 78 ----------------------------------------- include/coap3/coap.h.in | 1 - include/coap3/option.h | 2 -- 4 files changed, 82 deletions(-) delete mode 100644 include/coap3/bits.h diff --git a/Makefile.am b/Makefile.am index 4e2c54df..f76a8418 100644 --- a/Makefile.am +++ b/Makefile.am @@ -137,7 +137,6 @@ libcoap_includedir = $(includedir)/coap$(LIBCOAP_API_VERSION)/ libcoap_include_HEADERS = \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/address.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/async.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/bits.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/block.h \ $(top_builddir)/include/coap$(LIBCOAP_API_VERSION)/coap.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_cache.h \ diff --git a/include/coap3/bits.h b/include/coap3/bits.h deleted file mode 100644 index 3b187148..00000000 --- a/include/coap3/bits.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * bits.h -- bit vector manipulation - * - * Copyright (C) 2010-2011 Olaf Bergmann - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -/** - * @file bits.h - * @brief Bit vector manipulation - */ - -#ifndef COAP_BITS_H_ -#define COAP_BITS_H_ - -#include - -/** - * Sets the bit @p bit in bit-vector @p vec. This function returns @c 1 if bit - * was set or @c -1 on error (i.e. when the given bit does not fit in the - * vector). - * - * @param vec The bit-vector to change. - * @param size The size of @p vec in bytes. - * @param bit The bit to set in @p vec. - * - * @return @c -1 if @p bit does not fit into @p vec, @c 1 otherwise. - */ -COAP_STATIC_INLINE int -bits_setb(uint8_t *vec, size_t size, uint8_t bit) { - if (size <= ((size_t)bit >> 3)) - return -1; - - *(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07)); - return 1; -} - -/** - * Clears the bit @p bit from bit-vector @p vec. This function returns @c 1 if - * bit was cleared or @c -1 on error (i.e. when the given bit does not fit in - * the vector). - * - * @param vec The bit-vector to change. - * @param size The size of @p vec in bytes. - * @param bit The bit to clear from @p vec. - * - * @return @c -1 if @p bit does not fit into @p vec, @c 1 otherwise. - */ -COAP_STATIC_INLINE int -bits_clrb(uint8_t *vec, size_t size, uint8_t bit) { - if (size <= ((size_t)bit >> 3)) - return -1; - - *(vec + (bit >> 3)) &= (uint8_t)(~(1 << (bit & 0x07))); - return 1; -} - -/** - * Gets the status of bit @p bit from bit-vector @p vec. This function returns - * @c 1 if the bit is set, @c 0 otherwise (even in case of an error). - * - * @param vec The bit-vector to read from. - * @param size The size of @p vec in bytes. - * @param bit The bit to get from @p vec. - * - * @return @c 1 if the bit is set, @c 0 otherwise. - */ -COAP_STATIC_INLINE int -bits_getb(const uint8_t *vec, size_t size, uint8_t bit) { - if (size <= ((size_t)bit >> 3)) - return -1; - - return (*(vec + (bit >> 3)) & (1 << (bit & 0x07))) != 0; -} - -#endif /* COAP_BITS_H_ */ diff --git a/include/coap3/coap.h.in b/include/coap3/coap.h.in index a75708d5..d805c551 100644 --- a/include/coap3/coap.h.in +++ b/include/coap3/coap.h.in @@ -38,7 +38,6 @@ extern "C" { #include "coap@LIBCOAP_API_VERSION@/coap_forward_decls.h" #include "coap@LIBCOAP_API_VERSION@/address.h" #include "coap@LIBCOAP_API_VERSION@/async.h" -#include "coap@LIBCOAP_API_VERSION@/bits.h" #include "coap@LIBCOAP_API_VERSION@/block.h" #include "coap@LIBCOAP_API_VERSION@/coap_cache.h" #include "coap@LIBCOAP_API_VERSION@/coap_debug.h" diff --git a/include/coap3/option.h b/include/coap3/option.h index 4075e35c..cfc4dd94 100644 --- a/include/coap3/option.h +++ b/include/coap3/option.h @@ -15,8 +15,6 @@ #ifndef COAP_OPTION_H_ #define COAP_OPTION_H_ -#include "bits.h" - typedef uint16_t coap_option_num_t; /**