summaryrefslogtreecommitdiff
path: root/macros.h
Commit message (Collapse)AuthorAgeFilesLines
* macros.h: introduce sizeof_field macroEugene Syromyatnikov2020-01-171-1/+3
| | | | | | | Handy for field size checks. * macros.h (sizeof_field): New macro. (offsetofend): Use it.
* macros.h: include <stddef.h>Eugene Syromyatnikov2019-10-181-0/+1
| | | | | | | Since offsetofend macro definition relies on presence of offsetof declaration. * macros.h: Include <stddef.h>.
* Move FLAG_ macro from defs.h to macros.hEugene Syromyatnikov2019-10-041-0/+6
| | | | | | | | | | Rename it to FLAG and implement via newly added BIT helper macro, in preparation for general use * defs.h: Use FLAG instead of FLAG_. (FLAG_): Move it... * macros.h (FLAG): Here, implement using BIT macro. [!BIT] (BIT): New macro.
* Update copyright headersDmitry V. Levin2019-03-181-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Fix preprocessor indentationDmitry V. Levin2019-03-181-6/+6
| | | | | | | | | Indent the C preprocessor directives to reflect their nesting using the following script: $ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" done
* Add a generic list implementationEugene Syromyatnikov2019-03-061-0/+19
| | | | | | | | Similar to the one used in the Linux kernel. * macros.h (cast_ptr, containerof): New macros. * list.h: New file. * Makefile.am (strace_SOURCES): Add it.
* util: update dumpstrEugene Syromyatnikov2019-02-201-1/+5
| | | | | | | | | | | | | | | | | | | | Use a buffer of a limited size, use proper type for dump amount, avoid hard-coding of byte counts, calculate output buffer size more accurately and minimise its rewriting, pad offset with zeros in accordance with expected output amount. * defs.h (dumpstr): Change the type of len argument from int to kernel_ulong_t. * macros.h (ROUNDUP_DIV): New macro. (ROUNDUP): Rewrite using ROUNDUP_DIV. * util.c (ILOG2_ITER_): New macro. (ilog2_64, ilog2_32): New functions. (ilog2_klong): New macro, wrapper around ilog2_32/ilog2_64, so (potentially more expensive) ilog2_64 is not used for ilog2 calculation of a kernel_ulong_t-typed variable on architectures with 32-bit kernel long. (dumpstr): Update. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* Fix preprocessor indentationDmitry V. Levin2018-12-301-22/+22
| | | | | | | | | Indent the C preprocessor directives to reflect their nesting using the following script: $ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" done
* Change the license of strace to LGPL-2.1-or-laterDmitry V. Levin2018-12-101-21/+1
| | | | | | | | strace is now provided under the terms of the GNU Lesser General Public License version 2.1 or later, see COPYING for more details. strace test suite is now provided under the terms of the GNU General Public License version 2 or later, see tests/COPYING for more details.
* macros: add ROUNDUP macroEugene Syromyatnikov2018-09-021-0/+4
| | | | * macros.h (ROUNDUP): New macro.
* Introduce ARRSZ_PAIR macroEugene Syromyatnikov2018-05-301-0/+2
| | | | | | | A shorthand similar to ARG_STR in its purpose: it provides and ability to pass an array an its size without variable name duplication. * macros.h (ARRSZ_PAIR): New macro.
* Update copyright headersDmitry V. Levin2018-04-051-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Move is_filled and IS_ZERO to macros.h, rename IS_ZERO to IS_ARRAY_ZEROEugene Syromyatnikov2018-03-201-0/+16
| | | | | | | | | | * s390.c: Replace all IS_ZERO invocations with IS_ARRAY_ZERO. (is_filled, IS_ZERO): Move... * macros.h: ...here. (is_filled): Add inline qualifier, add const qualifier to ptr. (IS_ZERO): Rename to IS_ARRAY_ZERO, cast arr_ to "const char *". Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* Move MIN, MAX, and CLAMP to macros.hEugene Syromiatnikov2017-11-101-0/+8
| | | | | | | We shouldn't have to include the whole defs.h to get them. * defs.h (MIN, MAX, CLAMP): Move ... * macros.h: ... here.
* Move offsetofend from defs.h to macros.hDmitry V. Levin2017-07-261-0/+5
| | | | | * defs.h (offsetofend): Move ... * macros.h: ... here.
* Introduce generic STRINGIFY and STRINGIFY_VAL macrosDmitry V. Levin2017-07-021-0/+3
| | | | | | | | | | * macros.h (STRINGIFY, STRINGIFY_VAL): New macros. * mpers_type.h: Include "macros.h". [IN_MPERS] (STRINGIFY): Remove. * tests/sockname.c (TEST_SYSCALL_STR__, TEST_SYSCALL_STR_): Remove. (TEST_SYSCALL_STR): Use STRINGIFY_VAL. Co-authored-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
* Introduce macros.hDmitry V. Levin2017-07-021-0/+35
Introduce a separate header file for generic macros shared between strace and its tests. Start this unification with ARRAY_SIZE macro. * defs.h: Include "macros.h". (ARRAY_SIZE): Move ... * macros.h: ... to new file. * Makefile.am (strace_SOURCES): Add it. * tests/tests.h: Include "macros.h". (ARRAY_SIZE): Remove. All callers updated.