[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pushed 3 small patches: mostly build-related
From: |
Jim Meyering |
Subject: |
pushed 3 small patches: mostly build-related |
Date: |
Sat, 27 Mar 2010 10:54:36 +0100 |
The first patch is solely clean-up:
[PATCH 1/3] build: remove superfluous LOCALEDIR definition
The second one fixes a problem I encountered with #3
when I tried to include the newly-required, generated arg-nonnull.h
file from a non-srcdir build. I suspect it also fixes the problem
someone reported with getting the wrong getopt.h.
[PATCH 2/3] build: add -I$(top_builddir)/lib so we also find generated .h
files
This started off just correcting comments.
[PATCH 3/3] kwset: correct comments; require non-NULL kwsmatch argument
>From fc24c8fc93f2ae97eac06f4e64e82b2e2f9e5ab1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 27 Mar 2010 10:23:13 +0100
Subject: [PATCH 1/3] build: remove superfluous LOCALEDIR definition
* src/Makefile.am (INCLUDES): Remove unnecessary definition of
LOCALEDIR here. Now, it's defined via gnulib's configmake.h.
* src/system.h: Include "configmake.h" for its LOCALEDIR definition.
---
src/Makefile.am | 2 +-
src/system.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index a5d8eca..10516c9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,7 @@ LDADD = libgrep.a ../lib/libgreputils.a $(LIBINTL)
../lib/libgreputils.a
grep_LDADD = $(LDADD) $(LIB_PCRE)
localedir = $(datadir)/locale
-INCLUDES = -I$(top_srcdir)/lib -DLOCALEDIR=\"$(localedir)\"
+INCLUDES = -I$(top_srcdir)/lib
EXTRA_DIST = \
dosbuf.c \
diff --git a/src/system.h b/src/system.h
index 4398a5f..3b617fb 100644
--- a/src/system.h
+++ b/src/system.h
@@ -21,6 +21,7 @@
#include <errno.h>
#include "binary-io.h"
+#include "configmake.h"
#include "dirname.h"
#if O_BINARY
--
1.7.0.3.448.g82eeb
>From ef5011d294a4dfc21a726b3103e9d277912cabaf Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 27 Mar 2010 10:34:25 +0100
Subject: [PATCH 2/3] build: add -I$(top_builddir)/lib so we also find generated
.h files
* src/Makefile.am (AM_CPPFLAGS): Rename from INCLUDES to avoid
warning from automake -Wall.
Add -I$(top_builddir)/lib, so we find generated .h files like
getopt.h in a non-srcdir build.
---
src/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 10516c9..f0264b0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,7 @@ LDADD = libgrep.a ../lib/libgreputils.a $(LIBINTL)
../lib/libgreputils.a
grep_LDADD = $(LDADD) $(LIB_PCRE)
localedir = $(datadir)/locale
-INCLUDES = -I$(top_srcdir)/lib
+AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
EXTRA_DIST = \
dosbuf.c \
--
1.7.0.3.448.g82eeb
>From c03209e3bb4a64a4ceacf3c02e6ba69cb1457d4d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 27 Mar 2010 10:01:40 +0100
Subject: [PATCH 3/3] kwset: correct comments; require non-NULL kwsmatch argument
* src/kwset.c (kwsexec): Correct comments. This function has been
returning an offset, not a pointer, for 9 years.
Do not test for kwsmatch == NULL. All callers pass non-NULL.
(cwexec): Likewise.
* src/kwset.h (kwsexec): Mark the 4th parameter, kwsmatch, as non-NULL.
Include "arg-nonnull.h".
---
src/kwset.c | 29 ++++++++++++-----------------
src/kwset.h | 6 ++++--
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/src/kwset.c b/src/kwset.c
index 9e3a675..050562e 100644
--- a/src/kwset.c
+++ b/src/kwset.c
@@ -583,7 +583,7 @@ bmexec (kwset_t kws, char const *text, size_t size)
}
/* Hairy multiple string search. */
-static size_t
+static size_t _GL_ARG_NONNULL ((4))
cwexec (kwset_t kws, char const *text, size_t len, struct kwsmatch *kwsmatch)
{
struct kwset const *kwset;
@@ -731,31 +731,26 @@ cwexec (kwset_t kws, char const *text, size_t len, struct
kwsmatch *kwsmatch)
d = 1;
}
- if (kwsmatch)
- {
- kwsmatch->index = accept->accepting / 2;
- kwsmatch->offset[0] = mch - text;
- kwsmatch->size[0] = accept->depth;
- }
+ kwsmatch->index = accept->accepting / 2;
+ kwsmatch->offset[0] = mch - text;
+ kwsmatch->size[0] = accept->depth;
+
return mch - text;
}
-/* Search through the given text for a match of any member of the
- given keyword set. Return a pointer to the first character of
- the matching substring, or NULL if no match is found. If FOUNDLEN
- is non-NULL store in the referenced location the length of the
- matching substring. Similarly, if FOUNDIDX is non-NULL, store
- in the referenced location the index number of the particular
- keyword matched. */
+/* Search TEXT for a match of any member of the keyword set, KWS.
+ Return the offset (into TEXT) of the first byte of the matching substring,
+ or (size_t) -1 if no match is found. Upon a match, store details in
+ *KWSMATCH: index of matched keyword, start offset (same as the return
+ value), and length. */
size_t
-kwsexec (kwset_t kws, char const *text, size_t size,
- struct kwsmatch *kwsmatch)
+kwsexec (kwset_t kws, char const *text, size_t size, struct kwsmatch *kwsmatch)
{
struct kwset const *kwset = (struct kwset *) kws;
if (kwset->words == 1 && kwset->trans == NULL)
{
size_t ret = bmexec (kws, text, size);
- if (kwsmatch != NULL && ret != (size_t) -1)
+ if (ret != (size_t) -1)
{
kwsmatch->index = 0;
kwsmatch->offset[0] = ret;
diff --git a/src/kwset.h b/src/kwset.h
index 6861be5..35caa41 100644
--- a/src/kwset.h
+++ b/src/kwset.h
@@ -28,6 +28,8 @@ struct kwsmatch
size_t size[1]; /* Length of each submatch. */
};
+#include "arg-nonnull.h"
+
struct kwset;
typedef struct kwset *kwset_t;
@@ -52,8 +54,8 @@ extern const char *kwsprep (kwset_t);
the matching substring in the integer it points to. Similarly,
if foundindex is non-NULL, store the index of the particular
keyword found therein. */
-extern size_t kwsexec (kwset_t, char const *, size_t, struct kwsmatch *);
+extern size_t kwsexec (kwset_t, char const *, size_t, struct kwsmatch *)
+ _GL_ARG_NONNULL ((4));
/* Deallocate the given keyword set and all its associated storage. */
extern void kwsfree (kwset_t);
-
--
1.7.0.3.448.g82eeb
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pushed 3 small patches: mostly build-related,
Jim Meyering <=