]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
kwset: Usability tweaks.
authorBruno Haible <bruno@clisp.org>
Wed, 25 Jun 2025 12:28:25 +0000 (14:28 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 25 Jun 2025 13:58:41 +0000 (15:58 +0200)
* lib/kwset.h: Make header idempotent and C++ safe. Check that config.h
was already included.

ChangeLog
lib/kwset.h

index c9c4485672e02a1f9dba5a715b07e01e56c811e2..b742e916015eea70d79f090086fbc7252467b67a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-06-25  Bruno Haible  <bruno@clisp.org>
 
+       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.
index df9ce087f6a9fbc043675159d452a944629d6b85..204f40980831e71a3b7735d032c47a337c760867 100644 (file)
 
 /* 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 <stddef.h>
 
-#include <idx.h>
+#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 <arg-nonnull.h>
-#include <idx.h>
-
 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 */