mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
mhd_arr_num_elems: added new helper macro
This commit is contained in:
@@ -33,7 +33,7 @@ libmicrohttpd2_la_SOURCES = \
|
||||
compat_calloc.h \
|
||||
sys_w32_ver.h \
|
||||
mhd_assert.h \
|
||||
mhd_cntnr_ptr.h \
|
||||
mhd_cntnr_ptr.h mhd_arr_num_elems.h \
|
||||
mhd_tristate.h \
|
||||
mhd_socket_type.h mhd_sockets_macros.h \
|
||||
mhd_sockets_funcs.c mhd_sockets_funcs.h \
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "sys_base_types.h"
|
||||
#include "mhd_public_api.h"
|
||||
#include "mhd_str_macros.h"
|
||||
#include "mhd_arr_num_elems.h"
|
||||
|
||||
#define UNUSED_STATUS {0, NULL}
|
||||
|
||||
@@ -165,7 +166,7 @@ struct mhd_HttpStatusesBlock
|
||||
const struct MHD_String *const data;
|
||||
};
|
||||
|
||||
#define STATUSES_BLOCK(m) { (sizeof(m) / sizeof(m[0])), m}
|
||||
#define STATUSES_BLOCK(m) { mhd_ARR_NUM_ELEMS (m), m}
|
||||
|
||||
static const struct mhd_HttpStatusesBlock statuses[] = {
|
||||
STATUSES_BLOCK (invalid_hundred),
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This file is part of GNU libmicrohttpd
|
||||
Copyright (C) 2024 Evgeny Grin (Karlson2k)
|
||||
|
||||
GNU libmicrohttpd is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
GNU libmicrohttpd is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file src/mhd2/mhd_arr_num_elements.h
|
||||
* @brief The definition of mhd_ARR_NUM_ELEMS macro
|
||||
* @author Karlson2k (Evgeny Grin)
|
||||
*/
|
||||
|
||||
#ifndef MHD_ARR_NUM_ELEMS_H
|
||||
#define MHD_ARR_NUM_ELEMS_H 1
|
||||
|
||||
#include "mhd_sys_options.h"
|
||||
|
||||
/**
|
||||
* Get the number of elements in the array
|
||||
*/
|
||||
#define mhd_ARR_NUM_ELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#endif /* ! MHD_ARR_NUM_ELEMS_H */
|
||||
Reference in New Issue
Block a user