[Midnightbsd-cvs] src [11536] trunk/usr.bin/grep/queue.c: sync grep with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 16:34:23 EDT 2018
Revision: 11536
http://svnweb.midnightbsd.org/src/?rev=11536
Author: laffer1
Date: 2018-07-07 16:34:22 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync grep with freebsd.
Modified Paths:
--------------
trunk/usr.bin/grep/queue.c
Modified: trunk/usr.bin/grep/queue.c
===================================================================
--- trunk/usr.bin/grep/queue.c 2018-07-07 20:34:05 UTC (rev 11535)
+++ trunk/usr.bin/grep/queue.c 2018-07-07 20:34:22 UTC (rev 11536)
@@ -1,5 +1,6 @@
-/* $NetBSD: queue.c,v 1.2 2011/02/16 01:31:33 joerg Exp $ */
-/* $MidnightBSD$ */
+/* $MidnightBSD$ */
+/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */
+/* $FreeBSD: stable/10/usr.bin/grep/queue.c 268966 2014-07-21 22:59:40Z pfg $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -33,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/grep/queue.c 268966 2014-07-21 22:59:40Z pfg $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -68,8 +69,11 @@
STAILQ_INSERT_TAIL(&queue, item, list);
- if (++count > Bflag)
- free(dequeue());
+ if (++count > Bflag) {
+ item = dequeue();
+ free(item->data.dat);
+ free(item);
+ }
}
static struct qentry *
@@ -92,7 +96,8 @@
struct qentry *item;
while ((item = dequeue()) != NULL) {
- printline(&item->data, '-', (regmatch_t *)NULL, 0);
+ printline(&item->data, '-', NULL, 0);
+ free(item->data.dat);
free(item);
}
}
@@ -102,6 +107,8 @@
{
struct qentry *item;
- while ((item = dequeue()) != NULL)
+ while ((item = dequeue()) != NULL) {
+ free(item->data.dat);
free(item);
+ }
}
More information about the Midnightbsd-cvs
mailing list