lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20190528073932.25365-3-alexandru.ardelean@analog.com> Date: Tue, 28 May 2019 10:39:32 +0300 From: Alexandru Ardelean <alexandru.ardelean@...log.com> To: <linuxppc-dev@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>, <linux-ide@...r.kernel.org>, <linux-clk@...r.kernel.org>, <linux-rpi-kernel@...ts.infradead.org>, <linux-arm-kernel@...ts.infradead.org>, <linux-rockchip@...ts.infradead.org>, <linux-pm@...r.kernel.org>, <linux-gpio@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>, <intel-gfx@...ts.freedesktop.org>, <linux-omap@...r.kernel.org>, <linux-mmc@...r.kernel.org>, <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>, <linux-pci@...r.kernel.org>, <linux-tegra@...r.kernel.org>, <devel@...verdev.osuosl.org>, <linux-usb@...r.kernel.org>, <kvm@...r.kernel.org>, <linux-fbdev@...r.kernel.org>, <linux-mtd@...ts.infradead.org>, <cgroups@...r.kernel.org>, <linux-mm@...ck.org>, <linux-security-module@...r.kernel.org>, <linux-integrity@...r.kernel.org>, <alsa-devel@...a-project.org> CC: <heikki.krogerus@...ux.intel.com>, <gregkh@...uxfoundation.org>, <andriy.shevchenko@...ux.intel.com>, Alexandru Ardelean <alexandru.ardelean@...log.com> Subject: [PATCH 3/3][V2] lib: re-introduce new match_string() helper/macro This change re-introduces `match_string()` as a macro that uses ARRAY_SIZE() to compute the size of the array. After this change, work can start on migrating subsystems to use this new helper. Since the original helper is pretty used, migrating to this new one will take a while, and will be reviewed by each subsystem. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com> --- include/linux/string.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index 7149fcdf62df..34491b075449 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -198,6 +198,15 @@ static inline int strtobool(const char *s, bool *res) int __match_string(const char * const *array, size_t n, const char *string); int __sysfs_match_string(const char * const *array, size_t n, const char *s); +/** + * match_string - matches given string in an array + * @_a: array of strings + * @_s: string to match with + * + * Helper for __match_string(). Calculates the size of @a automatically. + */ +#define match_string(_a, _s) __match_string(_a, ARRAY_SIZE(_a), _s) + /** * sysfs_match_string - matches given string in an array * @_a: array of strings -- 2.20.1
Powered by blists - more mailing lists