Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/external/bsd/nvi/dist/ex Pull up following revision(s) (r...
details: https://anonhg.NetBSD.org/src/rev/f3c588eb416e
branches: netbsd-7
changeset: 798373:f3c588eb416e
user: martin <martin%NetBSD.org@localhost>
date: Mon Sep 22 11:04:05 2014 +0000
description:
Pull up following revision(s) (requested by aymeric in ticket #112):
external/bsd/nvi/dist/ex/tag.h: revision 1.4
external/bsd/nvi/dist/ex/ex_tag.c: revision 1.12
external/bsd/nvi/dist/ex/ex_cscope.c: revision 1.6
external/bsd/nvi/dist/ex/ex_cscope.c: revision 1.7
In tagq_free(), fix the test checking whether a TAGQ should be removed from
its tailq. This required introducing a new flag in the TAGQ structure to
avoid reverting to poking under the hood of the queue.h API.
The concrete bug it solves is that using tags would make vi crash reliably
on exit.
missed setting TAG_IS_LINKED in a special case in my previous commit.
Bug reported by Brad Harder, thanks!
diffstat:
external/bsd/nvi/dist/ex/ex_cscope.c | 6 ++++--
external/bsd/nvi/dist/ex/ex_tag.c | 9 ++++++---
external/bsd/nvi/dist/ex/tag.h | 3 ++-
3 files changed, 12 insertions(+), 6 deletions(-)
diffs (102 lines):
diff -r 935c4cb5e278 -r f3c588eb416e external/bsd/nvi/dist/ex/ex_cscope.c
--- a/external/bsd/nvi/dist/ex/ex_cscope.c Mon Sep 22 10:47:39 2014 +0000
+++ b/external/bsd/nvi/dist/ex/ex_cscope.c Mon Sep 22 11:04:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_cscope.c,v 1.5 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: ex_cscope.c,v 1.5.6.1 2014/09/22 11:04:05 martin Exp $ */
/*-
* Copyright (c) 1994, 1996
* Rob Mayoff. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: ex_cscope.c,v 10.21 2003/11/05 17:11:54 skimo Exp (Berkeley) Date: 2003/11/05 17:11:54 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: ex_cscope.c,v 1.5 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: ex_cscope.c,v 1.5.6.1 2014/09/22 11:04:05 martin Exp $");
#endif
#include <sys/param.h>
@@ -542,6 +542,7 @@
*/
if (TAILQ_EMPTY(&exp->tq)) {
TAILQ_INSERT_HEAD(&exp->tq, rtqp, q);
+ F_SET(rtqp, TAG_IS_LINKED);
} else {
free(rtqp);
rtqp = TAILQ_FIRST(&exp->tq);
@@ -549,6 +550,7 @@
/* Link the current TAGQ structure into place. */
TAILQ_INSERT_HEAD(&exp->tq, tqp, q);
+ F_SET(tqp, TAG_IS_LINKED);
(void)cscope_search(sp, tqp, tqp->current);
diff -r 935c4cb5e278 -r f3c588eb416e external/bsd/nvi/dist/ex/ex_tag.c
--- a/external/bsd/nvi/dist/ex/ex_tag.c Mon Sep 22 10:47:39 2014 +0000
+++ b/external/bsd/nvi/dist/ex/ex_tag.c Mon Sep 22 11:04:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_tag.c,v 1.11 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: ex_tag.c,v 1.11.6.1 2014/09/22 11:04:05 martin Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -19,7 +19,7 @@
static const char sccsid[] = "Id: ex_tag.c,v 10.50 2004/03/16 14:09:11 skimo Exp (Berkeley) Date: 2004/03/16 14:09:11 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: ex_tag.c,v 1.11 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: ex_tag.c,v 1.11.6.1 2014/09/22 11:04:05 martin Exp $");
#endif
#include <sys/param.h>
@@ -606,6 +606,7 @@
TAILQ_INSERT_TAIL(&tqp->tagq, tp, q);
}
TAILQ_INSERT_TAIL(&nexp->tq, tqp, q);
+ F_SET(tqp, TAG_IS_LINKED);
}
/* Copy list of tag files. */
@@ -740,7 +741,7 @@
* If allocated and then the user failed to switch files, the TAGQ
* structure was never attached to any list.
*/
- if (TAILQ_NEXT(tqp, q) != NULL)
+ if (F_ISSET(tqp, TAG_IS_LINKED))
TAILQ_REMOVE(&exp->tq, tqp, q);
free(tqp);
return (0);
@@ -810,6 +811,7 @@
*/
if (TAILQ_EMPTY(&exp->tq)) {
TAILQ_INSERT_HEAD(&exp->tq, rtqp, q);
+ F_SET(rtqp, TAG_IS_LINKED);
} else {
free(rtqp);
rtqp = TAILQ_FIRST(&exp->tq);
@@ -817,6 +819,7 @@
/* Link the new TAGQ structure into place. */
TAILQ_INSERT_HEAD(&exp->tq, tqp, q);
+ F_SET(tqp, TAG_IS_LINKED);
(void)ctag_search(sp,
tqp->current->search, tqp->current->slen, tqp->tag);
diff -r 935c4cb5e278 -r f3c588eb416e external/bsd/nvi/dist/ex/tag.h
--- a/external/bsd/nvi/dist/ex/tag.h Mon Sep 22 10:47:39 2014 +0000
+++ b/external/bsd/nvi/dist/ex/tag.h Mon Sep 22 11:04:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tag.h,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: tag.h,v 1.3.6.1 2014/09/22 11:04:05 martin Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -104,6 +104,7 @@
size_t tlen; /* Tag string length. */
#define TAG_CSCOPE 0x01 /* Cscope tag. */
+#define TAG_IS_LINKED 0x02 /* Tag was inserted into linked list */
u_int8_t flags;
char buf[1]; /* Variable length buffer. */
Home |
Main Index |
Thread Index |
Old Index