regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / array.h
blob1e23b5f6d0af1945efcb93e5d2bac49f4ac6e632
1 /** @file
2 * Utility functions/macros for handling arrays, C and/or glib.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #ifndef __WSUTIL_ARRAY_H__
12 #define __WSUTIL_ARRAY_H__
14 #include <stdlib.h>
15 #include <glib.h>
17 /** Useful when you have an array whose size is known at compile-time. */
18 #define array_length(x) (sizeof (x) / sizeof (x)[0])
20 /** glib doesn't have g_ptr_array_len, of all things! */
21 #ifndef g_ptr_array_len
22 #define g_ptr_array_len(a) ((a) ? (a)->len : 0)
23 #endif
25 #endif /* __WSUTIL_ARRAY_H__ */