[bitset] unused -> remove

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2982 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.36
Stefan Bühler 8 years ago
parent 66ad587f2f
commit bfce99aacc

@ -424,7 +424,7 @@ SET(COMMON_SRC
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

@ -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 \

@ -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 \

@ -1,67 +0,0 @@
#include "buffer.h"
#include "bitset.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#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;
}

@ -1,19 +0,0 @@
#ifndef _BITSET_H_
#define _BITSET_H_
#include <stddef.h>
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

@ -6,7 +6,6 @@
#endif
#include "settings.h"
#include "bitset.h"
#if defined HAVE_STDINT_H
# include <stdint.h>

Loading…
Cancel
Save