X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_deq.h;h=3182baae023650fbae9ac2a70b39f9eefaa65a1d;hb=9ccd38b6341bd42732ecbaa214012d01064f622a;hp=150864b5d01d2fff91dc29a181efc559ab4bf719;hpb=1265bb33a47bff9eb7fad7eb767b3827f874431a;p=collectd.git diff --git a/src/utils_deq.h b/src/utils_deq.h index 150864b5..3182baae 100644 --- a/src/utils_deq.h +++ b/src/utils_deq.h @@ -1,3 +1,29 @@ +/** + * collectd - src/utils_deq.h + * Copyright(c) 2017 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Andy Smith + */ + #ifndef utils_deq_h #define utils_deq_h 1 @@ -12,25 +38,6 @@ #define NEW_ARRAY(t, n) (t *)malloc(sizeof(t) * (n)) #define NEW_PTR_ARRAY(t, n) (t **)malloc(sizeof(t *) * (n)) -// -// If available, use aligned_alloc for cache-line-aligned allocations. Otherwise -// fall back to plain malloc. -// -#define NEW_CACHE_ALIGNED(t, p) \ - do { \ - if (posix_memalign( \ - (void *)&(p), 64, \ - (sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0))) != 0) \ - (p) = 0; \ - } while (0) - -#define ALLOC_CACHE_ALIGNED(s, p) \ - do { \ - if (posix_memalign((void *)&(p), 64, \ - (s + (s % 64 ? 64 - (s % 64) : 0))) != 0) \ - (p) = 0; \ - } while (0) - #define ZERO(p) memset(p, 0, sizeof(*p)) #define DEQ_DECLARE(i, d) \