From: Bruno Haible Date: Wed, 25 Jun 2025 12:28:25 +0000 (+0200) Subject: kwset: Usability tweaks. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e332950f1edd1d2d3e02662a6da8c1f0b26c999b;p=thirdparty%2Fgnulib.git kwset: Usability tweaks. * lib/kwset.h: Make header idempotent and C++ safe. Check that config.h was already included. --- diff --git a/ChangeLog b/ChangeLog index c9c4485672..b742e91601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2025-06-25 Bruno Haible + kwset: Usability tweaks. + * lib/kwset.h: Make header idempotent and C++ safe. Check that config.h + was already included. + kwset: New module. * lib/kwset.h: New file, from GNU grep. * lib/kwset.c: New file, from GNU grep. diff --git a/lib/kwset.h b/lib/kwset.h index df9ce087f6..204f409808 100644 --- a/lib/kwset.h +++ b/lib/kwset.h @@ -17,9 +17,22 @@ /* Written August 1989 by Mike Haertel. */ +#ifndef _KWSET_H +#define _KWSET_H + +/* This file uses _GL_ATTRIBUTE_PURE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include -#include +#include "arg-nonnull.h" +#include "idx.h" + +#ifdef __cplusplus +extern "C" { +#endif struct kwsmatch { @@ -28,9 +41,6 @@ struct kwsmatch idx_t size; /* Length of match. */ }; -#include -#include - struct kwset; typedef struct kwset *kwset_t; @@ -42,3 +52,9 @@ extern ptrdiff_t kwsexec (kwset_t, char const *, idx_t, struct kwsmatch *, bool) _GL_ARG_NONNULL ((4)); extern void kwsfree (kwset_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _KWSET_H */