File: array.h

package info (click to toggle)
wireshark 4.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 351,436 kB
  • sloc: ansic: 3,103,613; cpp: 129,736; xml: 100,978; python: 56,510; perl: 24,575; sh: 5,874; lex: 4,383; pascal: 4,304; makefile: 164; ruby: 113; objc: 91; tcl: 35
file content (25 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/** @file
 * Utility functions/macros for handling arrays, C and/or glib.
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef __WSUTIL_ARRAY_H__
#define __WSUTIL_ARRAY_H__

#include <stdlib.h>
#include <glib.h>

/** 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__ */