On Sat, Aug 20, 2016 at 05:52:09PM -0700, Jim Meyering wrote:
On Thu, Aug 18, 2016 at 3:50 AM, Zev Weiss <z...@bewilderbeest.net> wrote:
Hello,
<snip>
Thank you for separating those so nicely.
I have pushed your patches 2..6, now, so will close this.
The only changes I made were to the formatting and member ordering of
struct lexer_state. At first glance, I thought reordering would save
some space, but ended up with a size of 56 bytes on x86_64 regardless.
However, I did move both "int cur_mb_len" and "bool laststart" to the
end, and note that changing the type of cur_mb_len to short int
(perhaps in a later patch) will reduce the size of that struct to 48.
Thanks, Jim.
Also, after your comments on the first patch I noticed there were a
couple more function parameters that could have been const in the
subsequent patches as well; the attached patch marks them as such.
Zev
>From 7724587328b45de16a9c7e45eba03acc51767a19 Mon Sep 17 00:00:00 2001
From: Zev Weiss <z...@bewilderbeest.net>
Date: Sat, 20 Aug 2016 20:01:43 -0500
Subject: [PATCH] dfa: constify some function parameters
* src/dfa.c (char_context): Mark dfa parameter const.
(charclass_context): Likewise.
---
src/dfa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 33b3cd0..4e2fe61 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -748,7 +748,7 @@ unibyte_word_constituent (unsigned char c)
}
static int
-char_context (struct dfa *dfa, unsigned char c)
+char_context (struct dfa const *dfa, unsigned char c)
{
if (c == dfa->syntax.eolbyte)
return CTX_NEWLINE;
@@ -2291,7 +2291,7 @@ epsclosure (position_set *s, struct dfa const *d, char *visited)
character included in C. */
static int
-charclass_context (struct dfa *dfa, charclass c)
+charclass_context (struct dfa const *dfa, charclass c)
{
int context = 0;
unsigned int j;
--
2.8.1