Module Name:    othersrc
Committed By:   agc
Date:           Sun Dec  3 21:25:56 UTC 2017

Modified Files:
        othersrc/external/bsd/agcre/dist: comp.c error.c exec.c
        othersrc/external/bsd/agcre/dist/tests: 54.expected

Log Message:
remove some functions which were unused (obscured by being inline functions)

preserve the compilation flags across calls to exec()

update a test for current behavior


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/agcre/dist/comp.c \
    othersrc/external/bsd/agcre/dist/error.c \
    othersrc/external/bsd/agcre/dist/exec.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/agcre/dist/tests/54.expected

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/agcre/dist/comp.c
diff -u othersrc/external/bsd/agcre/dist/comp.c:1.1 othersrc/external/bsd/agcre/dist/comp.c:1.2
--- othersrc/external/bsd/agcre/dist/comp.c:1.1	Wed Aug 16 23:38:13 2017
+++ othersrc/external/bsd/agcre/dist/comp.c	Sun Dec  3 21:25:56 2017
@@ -647,7 +647,7 @@ regextend(const char *in, size_t insize,
 
 /* parse the string */
 static retoken_t *
-parse_string(re_t *re, input_t *in)
+parse_string(input_t *in)
 {
 	retoken_t	*dotstar;
 	retoken_t	*token;
@@ -676,7 +676,7 @@ agcre_parse_extended(agcre_re_t *agcre, 
 	re_t		*re;
 
 	re = agcre->re_g;
-	if ((entry = parse_string(re, in)) == 0) {
+	if ((entry = parse_string(in)) == 0) {
 		memcpy(re->msg, in->msg, in->msgc);
 		return 0;
 	}
Index: othersrc/external/bsd/agcre/dist/error.c
diff -u othersrc/external/bsd/agcre/dist/error.c:1.1 othersrc/external/bsd/agcre/dist/error.c:1.2
--- othersrc/external/bsd/agcre/dist/error.c:1.1	Wed Aug 16 23:38:13 2017
+++ othersrc/external/bsd/agcre/dist/error.c	Sun Dec  3 21:25:56 2017
@@ -32,12 +32,17 @@
 #include "internal.h"
 #include "agcre.h"
 
+#ifndef USE_ARG
+#define USE_ARG(x)  /*LINTED*/(void)&x
+#endif
+
 /* format the error nicely */
 size_t
 agcre_regerror(int errcode, const agcre_re_t *agcre, char *errbuf, size_t size)
 {
 	re_t	*re;
 
+	USE_ARG(errcode);
 	if (agcre == NULL || size == 0 || errbuf == NULL) {
 		return 0;
 	}
Index: othersrc/external/bsd/agcre/dist/exec.c
diff -u othersrc/external/bsd/agcre/dist/exec.c:1.1 othersrc/external/bsd/agcre/dist/exec.c:1.2
--- othersrc/external/bsd/agcre/dist/exec.c:1.1	Wed Aug 16 23:38:13 2017
+++ othersrc/external/bsd/agcre/dist/exec.c	Sun Dec  3 21:25:56 2017
@@ -172,21 +172,6 @@ make_new_context(re_t *re, int n)
 	return ctx;
 }
 
-/* copy context entry */
-static inline void
-copy_context(context_t *to, context_t *from, uint32_t n)
-{
-	uint32_t	i;
-
-	to->next = NULL;
-	to->ref = 1;
-	to->c = from->c;
-	to->nsub = from->nsub;
-	for (i = 0 ; i < n ; i++) {
-		to->sub[i] = from->sub[i];
-	}
-}
-
 /* increment reference count in the context */
 static inline context_t *
 incref(context_t *ctx)
@@ -374,18 +359,6 @@ is_better_match(context_t *ctx, context_
 	return (ctxlen == prevlen) ? (ctx->sub[0].rm_so < prev->sub[0].rm_so) : 0;
 }
 
-/* free all contexts */
-static inline void
-free_contexts(context_t *ctx)
-{
-	context_t	*next;
-
-	for ( ; ctx ; ctx = next) {
-		next = ctx->next;
-		free(ctx);
-	}
-}
-
 /* get length of utf16 string in 16bit chars */
 static inline size_t 
 strlen16(const uint16_t *s)
@@ -435,6 +408,7 @@ agcre_regexec(agcre_re_t *agcre, const v
 	threadlist_t	*tmp;
 	context_t	*matched;
 	context_t	*ctx;
+	uint32_t	 prevflags;
 	input_t		 in;
 	instr_t		*instr;
 	size_t		 i;
@@ -470,6 +444,7 @@ agcre_regexec(agcre_re_t *agcre, const v
 	current = threadlist(re->instrc);
 	next = threadlist(re->instrc);
 	re->gen += 1;
+	prevflags = re->flags;
 	re->flags |= flags;
 	addthread(re, current, newthread(re->prog, ctx), &in, 0, 1);
 	ret = AGCRE_REG_FAILURE;
@@ -570,5 +545,6 @@ break_for:
 	free(current);
 	free(next);
 	decref(re, ctx);
+	re->flags = prevflags;
 	return ret;
 }

Index: othersrc/external/bsd/agcre/dist/tests/54.expected
diff -u othersrc/external/bsd/agcre/dist/tests/54.expected:1.1 othersrc/external/bsd/agcre/dist/tests/54.expected:1.2
--- othersrc/external/bsd/agcre/dist/tests/54.expected:1.1	Wed Aug 16 23:38:13 2017
+++ othersrc/external/bsd/agcre/dist/tests/54.expected	Sun Dec  3 21:25:56 2017
@@ -1,4 +1,4 @@
 /usr/include/rump/rumpuser_port.h:260:#ifndef __arraycount
 /usr/include/rump/rumpuser_port.h:261:#define __arraycount(_ar_) (sizeof(_ar_)/sizeof(_ar_[0]))
 /usr/include/sys/bitops.h:324:	for (__i = 0; __i < __arraycount(__v->_b); __i++)		\
-/usr/include/sys/cdefs.h:572:#define	__arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
+/usr/include/sys/cdefs.h:573:#define	__arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))

Reply via email to