bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dfa.c - order of include files


From: Paul Eggert
Subject: Re: dfa.c - order of include files
Date: Tue, 15 Jan 2013 13:05:47 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 01/15/13 10:34, Eric Blake wrote:
> it is considered poor practice to write a header that cannot be
> used without first including some other header.

Agreed, and I pushed this into grep.  It should fix the problem
in question.

>From a25802fcb14ef02e94855fdb320454f15e12d6a9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Tue, 15 Jan 2013 13:00:13 -0800
Subject: [PATCH] grep: make dfa.h standalone

Problem reported by Aharon Robbins in
<http://lists.gnu.org/archive/html/bug-grep/2013-01/msg00007.html>.
* src/dfa.c: Include dfa.h first, so that it's tested standalone.
No need to include <regex.h>, since we are in charge of dfa.h and
know that it includes <regex.h>.
* src/dfa.h: Include <regex.h> and <stddef.h>, so that it's standalone.
---
 src/dfa.c | 5 +++--
 src/dfa.h | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index a7c0bbc..39a5563 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -21,6 +21,9 @@
    Modified July, 1988 by Arthur David Olson to assist BMG speedups  */
 
 #include <config.h>
+
+#include "dfa.h"
+
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -55,8 +58,6 @@
 # include <langinfo.h>
 #endif
 
-#include "regex.h"
-#include "dfa.h"
 #include "xalloc.h"
 
 /* HPUX, define those as macros in sys/param.h */
diff --git a/src/dfa.h b/src/dfa.h
index 31ce42e..c58485a 100644
--- a/src/dfa.h
+++ b/src/dfa.h
@@ -18,6 +18,9 @@
 
 /* Written June, 1988 by Mike Haertel */
 
+#include <regex.h>
+#include <stddef.h>
+
 /* Element of a list of strings, at least one of which is known to
    appear in any R.E. matching the DFA. */
 struct dfamust
-- 
1.7.11.7





reply via email to

[Prev in Thread] Current Thread [Next in Thread]