git: 1d254d487260 - main - news/nn: remove sbrk use

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 08 Dec 2023 23:31:02 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1d254d487260e6e940a171aa0ab0d658b1a13407

commit 1d254d487260e6e940a171aa0ab0d658b1a13407
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-12-07 19:43:29 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-12-08 23:29:38 +0000

    news/nn: remove sbrk use
    
    It was used to report a heap size but this is inaccurate.  Just patch it
    out for now.
---
 news/nn/Makefile           |  5 +----
 news/nn/files/patch-init.c | 29 +++++++++++++++++++++++++++++
 news/nn/files/patch-nn.c   | 18 ++++++++++++++++++
 3 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/news/nn/Makefile b/news/nn/Makefile
index ce6bb9b93480..a60ffaf6d285 100644
--- a/news/nn/Makefile
+++ b/news/nn/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	nn
 PORTVERSION=	6.7.3
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	news
 MASTER_SITES=	ftp://ftp.nndev.org/pub/nn-${PORTVERSION:R}/
 
@@ -8,9 +8,6 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Menu based USENET newsreader
 WWW=		http://www.nndev.org/
 
-BROKEN_aarch64=	Fails to link: missing sbrk
-BROKEN_riscv64=	Fails to link: missing sbrk
-
 SUB_FILES=	pkg-message
 
 USES=		tar:Z
diff --git a/news/nn/files/patch-init.c b/news/nn/files/patch-init.c
new file mode 100644
index 000000000000..7d69ad2d6918
--- /dev/null
+++ b/news/nn/files/patch-init.c
@@ -0,0 +1,29 @@
+--- init.c.orig
++++ init.c
+@@ -58,8 +58,6 @@
+ int             in_init = 0;	/* true when parsing init file */
+ int             alt_cmd_key;	/* K_ when parse_command returns AC_KEYCMD */
+ 
+-long            initial_memory_break;	/* for :debug statistics */
+-
+ int             first_time_user = 0;
+ 
+ static int      init_err = 0;	/* errors in init file */
+@@ -566,17 +564,8 @@
+     struct mallinfo mallinfo(), mi;
+ #endif
+ 
+-    static long     prev_mem = 0;
+-    long            cur_mem;
+-
+     clrdisp();
+     tprintf("group=%s, nart=%ld\n\r", current_group->group_name, n_articles);
+-
+-    cur_mem = (((long) sbrk(0)) - initial_memory_break) / 1024;
+-
+-    tprintf("\nMemory usage: %ldk, previous: %ldk, change: %ldk\n\r",
+-	    cur_mem, prev_mem, cur_mem - prev_mem);
+-    prev_mem = cur_mem;
+ 
+ #ifdef USE_MALLOC_H
+     mi = mallinfo();
diff --git a/news/nn/files/patch-nn.c b/news/nn/files/patch-nn.c
new file mode 100644
index 000000000000..46f34fdd9f9c
--- /dev/null
+++ b/news/nn/files/patch-nn.c
@@ -0,0 +1,18 @@
+--- nn.c.orig
++++ nn.c
+@@ -74,7 +74,6 @@
+ extern int      seq_cross_filtering;
+ extern char    *news_active;
+ extern long     unread_articles;
+-extern long     initial_memory_break;
+ extern int      first_time_user;
+ extern int      also_cross_postings;
+ 
+@@ -745,7 +744,6 @@
+     int             say_welcome = 0, cmd;
+     flag_type       access_mode = 0;
+     char           *mask = NULL;
+-    initial_memory_break = (long) sbrk(0);
+ 
+ #ifdef USE_MALLOC_H
+