Skip to content

Commit

Permalink
news/nn: remove sbrk use
Browse files Browse the repository at this point in the history
It was used to report a heap size but this is inaccurate.  Just patch it
out for now.
  • Loading branch information
brooksdavis committed Dec 8, 2023
1 parent 975ef9b commit 1d254d4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
5 changes: 1 addition & 4 deletions news/nn/Makefile
@@ -1,16 +1,13 @@
PORTNAME= nn
PORTVERSION= 6.7.3
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= news
MASTER_SITES= ftp://ftp.nndev.org/pub/nn-${PORTVERSION:R}/

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
Expand Down
29 changes: 29 additions & 0 deletions 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();
18 changes: 18 additions & 0 deletions 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

0 comments on commit 1d254d4

Please sign in to comment.