author | Olivier Brunel
<jjk@jjacky.com> 2016-01-10 19:51:10 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2016-01-12 14:33:51 UTC |
parent | 8e43d0f701cf4258431cbf95de20ba4fd96ddb31 |
INSTALL | +1 | -1 |
src/libslicd/bitarray_clearsetn.c | +0 | -49 |
src/libslicd/bitarray_firstclear_skip.c | +0 | -57 |
src/libslicd/bitarray_firstset_skip.c | +0 | -57 |
src/libslicd/deps-lib/slicd | +0 | -3 |
src/libslicd/slicd_job.c | +4 | -14 |
diff --git a/INSTALL b/INSTALL index 0ee3380..0eac6f9 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 4.0 or later - - skalibs version 2.3.8.0 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.3.9.0 or later: http://skarnet.org/software/skalibs/ * Standard usage diff --git a/src/libslicd/bitarray_clearsetn.c b/src/libslicd/bitarray_clearsetn.c deleted file mode 100644 index 1c927cb..0000000 --- a/src/libslicd/bitarray_clearsetn.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * slicd - Copyright (C) 2015 Olivier Brunel - * - * bitarray_clearsetn.c - * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com> - * - * This file is part of slicd. - * - * slicd is free software: you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. - * - * slicd is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * slicd. If not, see http://www.gnu.org/licenses/ - */ -/* Based on bitarray_clearsetn.c from skalibs; ISC license - * Copyright (c) 2011-2015 Laurent Bercot <ska-skaware@skarnet.org> */ - -#include <skalibs/bitarray.h> - -void _bitarray_clearsetn (register unsigned char *s, - register unsigned int a, - register unsigned int b, - register unsigned int h) -{ - if (!b) return ; - b += a ; - if ((a >> 3) == ((b-1) >> 3)) - { - register unsigned char mask = ((1 << (a & 7)) - 1) ^ ((1 << ((b & 7) ? b & 7 : 8)) - 1) ; - if (h) s[a>>3] |= mask ; else s[a>>3] &= ~mask ; - } - else - { - register unsigned char mask = ~((1 << (a & 7)) - 1) ; - register unsigned int i = (a>>3) + 1 ; - if (h) s[a>>3] |= mask ; else s[a>>3] &= ~mask ; - mask = h ? 0xff : 0x00 ; - for (; i < b>>3 ; i++) s[i] = mask ; - mask = (1 << (b & 7)) - 1 ; - if (h) s[b>>3] |= mask ; else s[b>>3] &= ~mask ; - } -} diff --git a/src/libslicd/bitarray_firstclear_skip.c b/src/libslicd/bitarray_firstclear_skip.c deleted file mode 100644 index 97aae02..0000000 --- a/src/libslicd/bitarray_firstclear_skip.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * slicd - Copyright (C) 2015 Olivier Brunel - * - * bitarray_firstclear_skip.c - * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com> - * - * This file is part of slicd. - * - * slicd is free software: you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. - * - * slicd is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * slicd. If not, see http://www.gnu.org/licenses/ - */ -/* Based on bitarray_firstclear.c from skalibs; ISC license - * Copyright (c) 2011-2015 Laurent Bercot <ska-skaware@skarnet.org> */ - -#include <skalibs/bitarray.h> - -unsigned int -_bitarray_firstclear_skip (register unsigned char const *s, unsigned int max, unsigned int skip) -{ - unsigned int n = bitarray_div8 (max); - register unsigned int i = bitarray_div8 (skip); - - if (i && s[i - 1] != 0xffU) - { - register unsigned int j = skip; - - skip = i << 3; - if (skip > max) - skip = max; - while ((j < skip) && bitarray_peek (s, j)) - ++j; - if (j < skip) - return j; - } - - for ( ; i < n ; ++i) - if (s[i] != 0xffU) - break; - - if (i == n) - return max; - - i <<= 3; - while ((i < max) && bitarray_peek (s, i)) - ++i; - return i; -} diff --git a/src/libslicd/bitarray_firstset_skip.c b/src/libslicd/bitarray_firstset_skip.c deleted file mode 100644 index d6236cb..0000000 --- a/src/libslicd/bitarray_firstset_skip.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * slicd - Copyright (C) 2015 Olivier Brunel - * - * bitarray_firstset_skip.c - * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com> - * - * This file is part of slicd. - * - * slicd is free software: you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. - * - * slicd is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * slicd. If not, see http://www.gnu.org/licenses/ - */ -/* Based on bitarray_firstset.c from skalibs; ISC license - * Copyright (c) 2011-2015 Laurent Bercot <ska-skaware@skarnet.org> */ - -#include <skalibs/bitarray.h> - -unsigned int -_bitarray_firstset_skip (register unsigned char const *s, unsigned int max, unsigned int skip) -{ - unsigned int n = bitarray_div8 (max); - register unsigned int i = bitarray_div8 (skip); - - if (i && s[i - 1]) - { - register unsigned int j = skip; - - skip = i << 3; - if (skip > max) - skip = max; - while ((j < skip) && !bitarray_peek (s, j)) - ++j; - if (j < skip) - return j; - } - - for ( ; i < n ; ++i) - if (s[i]) - break; - - if (i == n) - return max; - - i <<= 3; - while ((i < max) && !bitarray_peek (s, i)) - ++i; - return i; -} diff --git a/src/libslicd/deps-lib/slicd b/src/libslicd/deps-lib/slicd index 7410daa..0165633 100644 --- a/src/libslicd/deps-lib/slicd +++ b/src/libslicd/deps-lib/slicd @@ -1,6 +1,3 @@ -bitarray_clearsetn.o -bitarray_firstclear_skip.o -bitarray_firstset_skip.o errmsg.o slicd_add_job_from_cronline.o slicd_die_usage.o diff --git a/src/libslicd/slicd_job.c b/src/libslicd/slicd_job.c index 6642ed5..a35a50e 100644 --- a/src/libslicd/slicd_job.c +++ b/src/libslicd/slicd_job.c @@ -27,16 +27,6 @@ #include <slicd/fields.h> #include <slicd/err.h> -extern void _bitarray_clearsetn (register unsigned char *s, - register unsigned int a, - register unsigned int b, - register unsigned int h); -extern unsigned int _bitarray_firstset_skip (register unsigned char const *s, - unsigned int max, - unsigned int skip); -extern unsigned int _bitarray_firstclear_skip (register unsigned char const *s, - unsigned int max, - unsigned int skip); #define ensure_in_range(field,n) \ if (n < 0 || n > _slicd_fields[field].max) \ @@ -70,7 +60,7 @@ slicd_job_set_days_combo (slicd_job_t *job, { assert (job != NULL); - _bitarray_clearsetn (job->bits, _SLICD_BIT_DAYS_COMBO, 1, what); + bitarray_clearsetn (job->bits, _SLICD_BIT_DAYS_COMBO, 1, what); return 0; } @@ -94,7 +84,7 @@ slicd_job_clearset (slicd_job_t *job, if (to < from) return -SLICD_ERR_INVALID_RANGE; - _bitarray_clearsetn (job->bits, _slicd_fields[field].offset + from, to - from + 1, what); + bitarray_clearsetn (job->bits, _slicd_fields[field].offset + from, to - from + 1, what); return 0; } @@ -123,9 +113,9 @@ slicd_job_first (slicd_job_t *job, from += _slicd_fields[field].offset; to += _slicd_fields[field].offset; if (what) - r = _bitarray_firstset_skip (job->bits, to + 1, from); + r = bitarray_firstset_skip (job->bits, to + 1, from); else - r = _bitarray_firstclear_skip (job->bits, to + 1, from); + r = bitarray_firstclear_skip (job->bits, to + 1, from); return _slicd_fields[field].adjust + r - _slicd_fields[field].offset; }