From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:53 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- wsutil/array.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 wsutil/array.h (limited to 'wsutil/array.h') diff --git a/wsutil/array.h b/wsutil/array.h new file mode 100644 index 00000000..1e23b5f6 --- /dev/null +++ b/wsutil/array.h @@ -0,0 +1,25 @@ +/** @file + * Utility functions/macros for handling arrays, C and/or glib. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __WSUTIL_ARRAY_H__ +#define __WSUTIL_ARRAY_H__ + +#include +#include + +/** Useful when you have an array whose size is known at compile-time. */ +#define array_length(x) (sizeof (x) / sizeof (x)[0]) + +/** glib doesn't have g_ptr_array_len, of all things! */ +#ifndef g_ptr_array_len +#define g_ptr_array_len(a) ((a) ? (a)->len : 0) +#endif + +#endif /* __WSUTIL_ARRAY_H__ */ -- cgit v1.2.3