Commit Graph

2 Commits

Author SHA1 Message Date
f236207f46 dyxlat: use xgrowarray
* dyxlat.c (dyxlat_alloc): Use xgrowarray instead of xcalloc.
(dyxlat_add_pair): Use xgrowarray instead of xreallocarray.
2017-12-14 00:05:04 +00:00
Masatake YAMATO
5dca1b261b dyxlat: new interface for building xlat tables dynamically
xlat tables are usually generated at build time.

printxval is suitable for printing struct nlmsghdr.nlmsg_type for
NETLINK_GENERIC protocol.  However, the corresponding xlat table
cannot be defined at build time because the values are registered
by the kernel at run time.

This change introduces dyxlat functions for building xlat tables
dynamically.  The primary use case is decoding nlmsg_type but this
interface can be used for other purposes.

* defs.h (struct dyxlat): New opaque data type.
(dyxlat_alloc, dyxlat_free, dyxlat_add_pair): New function declarations.
* dyxlat.c: New file.
* Makefile.am (strace_SOURCES): Add it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00