From bfce99aacc99d962a9855fbbae61c309728122fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sun, 8 Feb 2015 19:10:51 +0000 Subject: [PATCH 22/29] [bitset] unused -> remove MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2982 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/CMakeLists.txt | 2 +- src/Makefile.am | 4 ++-- src/SConscript | 2 +- src/bitset.c | 67 ------------------------------------------------------ src/bitset.h | 19 ---------------- src/fdevent.h | 1 - 6 files changed, 4 insertions(+), 91 deletions(-) delete mode 100644 src/bitset.c delete mode 100644 src/bitset.h diff --git a/src/Makefile.am b/src/Makefile.am index a5471ff..a4ada19 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,7 +66,7 @@ common_src=buffer.c log.c \ fdevent_poll.c fdevent_linux_sysepoll.c \ fdevent_solaris_devpoll.c fdevent_solaris_port.c \ fdevent_freebsd_kqueue.c \ - data_config.c bitset.c \ + data_config.c \ inet_ntop_cache.c crc32.c \ connections-glue.c \ configfile-glue.c \ @@ -273,7 +273,7 @@ hdr = server.h buffer.h network.h log.h keyvalue.h \ fdevent.h connections.h base.h stat_cache.h \ plugin.h mod_auth.h \ etag.h joblist.h array.h crc32.h \ - network_backends.h configfile.h bitset.h \ + network_backends.h configfile.h \ mod_ssi.h mod_ssi_expr.h inet_ntop_cache.h \ configparser.h mod_ssi_exprparser.h \ sys-mmap.h sys-socket.h mod_cml.h mod_cml_funcs.h \ diff --git a/src/SConscript b/src/SConscript index 7565094..bb507a5 100644 --- a/src/SConscript +++ b/src/SConscript @@ -14,7 +14,7 @@ common_src = Split("buffer.c log.c \ fdevent_poll.c fdevent_linux_sysepoll.c \ fdevent_solaris_devpoll.c fdevent_solaris_port.c \ fdevent_freebsd_kqueue.c \ - data_config.c bitset.c \ + data_config.c \ inet_ntop_cache.c crc32.c \ connections-glue.c \ configfile-glue.c \ diff --git a/src/bitset.c b/src/bitset.c deleted file mode 100644 index 27c93a8..0000000 --- a/src/bitset.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "buffer.h" -#include "bitset.h" - -#include -#include -#include -#include -#include - -#define BITSET_BITS \ - ( CHAR_BIT * sizeof(size_t) ) - -#define BITSET_MASK(pos) \ - ( ((size_t)1) << ((pos) % BITSET_BITS) ) - -#define BITSET_WORD(set, pos) \ - ( (set)->bits[(pos) / BITSET_BITS] ) - -#define BITSET_USED(nbits) \ - ( ((nbits) + (BITSET_BITS - 1)) / BITSET_BITS ) - -bitset *bitset_init(size_t nbits) { - bitset *set; - - set = malloc(sizeof(*set)); - force_assert(set); - - set->bits = calloc(BITSET_USED(nbits), sizeof(*set->bits)); - set->nbits = nbits; - - force_assert(set->bits); - - return set; -} - -void bitset_reset(bitset *set) { - memset(set->bits, 0, BITSET_USED(set->nbits) * sizeof(*set->bits)); -} - -void bitset_free(bitset *set) { - free(set->bits); - free(set); -} - -void bitset_clear_bit(bitset *set, size_t pos) { - if (pos >= set->nbits) { - SEGFAULT(); - } - - BITSET_WORD(set, pos) &= ~BITSET_MASK(pos); -} - -void bitset_set_bit(bitset *set, size_t pos) { - if (pos >= set->nbits) { - SEGFAULT(); - } - - BITSET_WORD(set, pos) |= BITSET_MASK(pos); -} - -int bitset_test_bit(bitset *set, size_t pos) { - if (pos >= set->nbits) { - SEGFAULT(); - } - - return (BITSET_WORD(set, pos) & BITSET_MASK(pos)) != 0; -} diff --git a/src/bitset.h b/src/bitset.h deleted file mode 100644 index 467e13f..0000000 --- a/src/bitset.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _BITSET_H_ -#define _BITSET_H_ - -#include - -typedef struct { - size_t *bits; - size_t nbits; -} bitset; - -bitset *bitset_init(size_t nbits); -void bitset_reset(bitset *set); -void bitset_free(bitset *set); - -void bitset_clear_bit(bitset *set, size_t pos); -void bitset_set_bit(bitset *set, size_t pos); -int bitset_test_bit(bitset *set, size_t pos); - -#endif diff --git a/src/fdevent.h b/src/fdevent.h index 5147baa..235d68b 100644 --- a/src/fdevent.h +++ b/src/fdevent.h @@ -6,7 +6,6 @@ #endif #include "settings.h" -#include "bitset.h" #if defined HAVE_STDINT_H # include -- 2.4.5