diff options
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index b2dd8f7d2..7c1a7ba0a 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2653,6 +2653,13 @@ static const char *categories[] = { "Antimalware", }; +#if !defined(NDPI_CFFI_PREPROCESSING) && defined(__linux__) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +_Static_assert(sizeof(categories) / sizeof(char *) == NDPI_PROTOCOL_NUM_CATEGORIES, + "Invalid categories length. Do you need to update 'categories' array or 'ndpi_protocol_category_t'?"); +#endif +#endif + /* ******************************************************************** */ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs prefs) { @@ -2815,13 +2822,6 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs ndpi_str->risky_domain_automa.ac_automa = NULL; /* Initialized on demand */ ndpi_str->trusted_issuer_dn = NULL; - if((sizeof(categories) / sizeof(char *)) != NDPI_PROTOCOL_NUM_CATEGORIES) { - NDPI_LOG_ERR(ndpi_str, "[NDPI] invalid categories length: expected %u, got %u\n", NDPI_PROTOCOL_NUM_CATEGORIES, - (unsigned int) (sizeof(categories) / sizeof(char *))); - ndpi_free(ndpi_str); - return(NULL); - } - ndpi_str->custom_categories.hostnames.ac_automa = ac_automata_init(ac_domain_match_handler); if(!ndpi_str->custom_categories.hostnames.ac_automa) { ndpi_exit_detection_module(ndpi_str); |