File: grok.diff

package info (click to toggle)
grok 1.20110708.1-4.3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,460 kB
  • sloc: ansic: 3,469; ruby: 987; makefile: 276; sh: 124; yacc: 106
file content (134 lines) | stat: -rw-r--r-- 4,978 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
diff --git a/Makefile b/Makefile
index a0ebd78..a072e6d 100644
--- a/Makefile
+++ b/Makefile
@@ -162,14 +162,14 @@ cleanver:
 # Binary creation
 grok: LDFLAGS+=-levent
 grok: $(GROKOBJ) conf.tab.o conf.yy.o main.o grok_config.o
-	gcc $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ -o $@
 
 discogrok: $(GROKOBJ) discover_main.o
-	gcc $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ -o $@
 
 libgrok.$(LIBSUFFIX): 
 libgrok.$(LIBSUFFIX): $(GROKOBJ) 
-	gcc $(LDFLAGS) -fPIC $(DYNLIBFLAG) $(LIBNAMEFLAG) $^ -o $@
+	$(CC) $(LDFLAGS) -fPIC $(DYNLIBFLAG) $(LIBNAMEFLAG) $^ -o $@
 
 libgrok.$(VERLIBSUFFIX): libgrok.$(LIBSUFFIX);
 	ln -s $< $@
diff --git a/grok_capture.c b/grok_capture.c
index 47c2678..70171a7 100644
--- a/grok_capture.c
+++ b/grok_capture.c
@@ -96,7 +96,7 @@ const grok_capture *grok_capture_get_by_id(grok_t *grok, int id) {
   return gct;
 }
 
-const grok_capture *grok_capture_get_by_name(grok_t *grok, const char *name) {
+const grok_capture *grok_capture_get_by_name(const grok_t *grok, const char *name) {
   int unused_size;
   const grok_capture *gct;
   const TCLIST *by_name_list;
@@ -111,7 +111,7 @@ const grok_capture *grok_capture_get_by_name(grok_t *grok, const char *name) {
   return gct;
 }
 
-const grok_capture *grok_capture_get_by_subname(grok_t *grok,
+const grok_capture *grok_capture_get_by_subname(const grok_t *grok,
                                                 const char *subname) {
   int unused_size;
   const grok_capture *gct;
@@ -213,11 +213,11 @@ void grok_capture_free(grok_capture *gct) {
 }
 
 /* this function will walk the captures_by_id table */
-void grok_capture_walk_init(grok_t *grok) {
+void grok_capture_walk_init(const grok_t *grok) {
   tctreeiterinit(grok->captures_by_id);
 }
 
-const grok_capture *grok_capture_walk_next(grok_t *grok) {
+const grok_capture *grok_capture_walk_next(const grok_t *grok) {
   int id_size;
   int gct_size;
   int *id;
diff --git a/grok_capture.h b/grok_capture.h
index 759903c..e3c3617 100644
--- a/grok_capture.h
+++ b/grok_capture.h
@@ -10,14 +10,14 @@ void grok_capture_free(grok_capture *gct);
 
 void grok_capture_add(grok_t *grok, const grok_capture *gct);
 const grok_capture *grok_capture_get_by_id(grok_t *grok, int id);
-const grok_capture *grok_capture_get_by_name(grok_t *grok, const char *name);
-const grok_capture *grok_capture_get_by_subname(grok_t *grok,
+const grok_capture *grok_capture_get_by_name(const grok_t *grok, const char *name);
+const grok_capture *grok_capture_get_by_subname(const grok_t *grok,
                                                 const char *subname);
 const grok_capture *grok_capture_get_by_capture_number(grok_t *grok,
                                                        int capture_number);
 
-void grok_capture_walk_init(grok_t *grok);
-const grok_capture *grok_capture_walk_next(grok_t *grok);
+void grok_capture_walk_init(const grok_t *grok);
+const grok_capture *grok_capture_walk_next(const grok_t *grok);
 
 int grok_capture_set_extra(grok_t *grok, grok_capture *gct, void *extra);
 void _grok_capture_encode(grok_capture *gct, char **data_ret, int *size_ret);
diff --git a/grok_logging.c b/grok_logging.c
index bbbba04..64f0bd0 100644
--- a/grok_logging.c
+++ b/grok_logging.c
@@ -1,5 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include <sys/types.h>
+#include <unistd.h>
 #include "grok.h"
 
 #ifndef NOLOGGING
diff --git a/grok_match.c b/grok_match.c
index ab7727c..2af0937 100644
--- a/grok_match.c
+++ b/grok_match.c
@@ -37,7 +37,7 @@ int grok_match_get_named_substring(const grok_match_t *gm, const char *name,
 }
 
 void grok_match_walk_init(const grok_match_t *gm) {
-  grok_t *grok = gm->grok;
+  const grok_t *grok = gm->grok;
   grok_capture_walk_init(grok);
 }
 
diff --git a/grok_matchconf.c b/grok_matchconf.c
index 7293961..d5553af 100644
--- a/grok_matchconf.c
+++ b/grok_matchconf.c
@@ -298,8 +298,8 @@ char *grok_matchconfig_filter_reaction(const char *str, grok_match_t *gm) {
               } else { /* VALUE_JSON_COMPLEX */ 
                 entry_len = asprintf(&entry, 
                                      "{ \"%.*s\": { "
-                                     "\"start\": %d, "
-                                     "\"end\": %d, "
+                                     "\"start\": %ld, "
+                                     "\"end\": %ld, "
                                      "\"value\": \"%.*s\""
                                      " } }, ",
                                      pname_len, pname, 
diff --git a/stringhelper.c b/stringhelper.c
index 206ae89..6d0f5df 100644
--- a/stringhelper.c
+++ b/stringhelper.c
@@ -244,7 +244,7 @@ char *string_ndup(const char *src, size_t size) {
 } /* char *string_ndup */
 
 int string_count(const char *src, const char *charlist) {
-  string_ncount(src, strlen(src), charlist, strlen(charlist));
+  return (string_ncount(src, strlen(src), charlist, strlen(charlist)));
 } /* int string_count */
 
 int string_ncount(const char *src, size_t srclen,