This wide-ranging change replaces the vast majority of instances of the "sizeof arr / sizeof (TYPE)" pattern (and a few more "sizeof arr / sizeof var", "sizeof arr / sizeof arr[1]", etc.) with the array_length macro. A small number of cases of "sizeof arr / sizeof (TYPE)" remain; These appear to be legitimate divisions of some array/variable's size by the size of some _other_ TYPE unrelated to the array/variable type -- i.e. computing number of records/samples which will fit in a given buffer. A few unused variables/macros were removed instead of being updated. Trivial formatting changes were made in a few places. As with the previous part of this cleanup, comparison of the built object files confirms that most of the changes have no net effect and the few actual changes are trivial and harmless. Some changes are apparent in debug info (to be expected), in __LINE__ values (also to be expected), and the simplification in the opcua plugin is reflected in slightly simpler generated code.
33 lines
694 B
C
33 lines
694 B
C
/*
|
|
* Copyright 2021, João Valverde <j@v6e.pt>
|
|
*
|
|
* Wireshark - Network traffic analyzer
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
* Copyright 1998 Gerald Combs
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
#include "config.h"
|
|
#include "introspection.h"
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <wsutil/array.h>
|
|
|
|
#include "introspection-enums.c"
|
|
|
|
const ws_enum_t *wtap_inspect_enums(void)
|
|
{
|
|
return all_enums;
|
|
}
|
|
|
|
size_t wtap_inspect_enums_count(void)
|
|
{
|
|
/* Exclude null terminator */
|
|
return array_length(all_enums) - 1;
|
|
}
|
|
|
|
const ws_enum_t *wtap_inspect_enums_bsearch(const char *needle)
|
|
{
|
|
return ws_enums_bsearch(all_enums, wtap_inspect_enums_count(), needle);
|
|
}
|