1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-30 10:38:37 +00:00

sysutils/LPRng: remove needless sbrk use

Move malloc_area global under defined(DEMALLOC) which contains all
consumers.  Delete unused Brk_check_size function.
This commit is contained in:
Brooks Davis 2023-12-08 20:02:23 +00:00
parent 162f181fec
commit 9aff84db28
4 changed files with 59 additions and 6 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= LPRng
PORTVERSION= 3.8.C
PORTREVISION= 5
PORTREVISION= 6
PORTEPOCH= 1
CATEGORIES= sysutils print
MASTER_SITES= SF/${PORTNAME:tl}/${PORTNAME:tl}
@ -13,9 +13,6 @@ WWW= https://lprng.sourceforge.net/
LICENSE= ART10 GPLv2
LICENSE_COMB= dual
BROKEN_aarch64= Fails to link: missing sbrk
BROKEN_riscv64= Fails to link: missing sbrk
LIB_DEPENDS= libgdbm.so:databases/gdbm
USES= gmake ssl

View File

@ -1,6 +1,27 @@
--- src/common/lpd.c.orig
+++ src/common/lpd.c
@@ -979,7 +979,6 @@
@@ -64,7 +64,9 @@
*
****************************************************************************/
+#ifdef DMALLOC
static char *malloc_area;
+#endif
int main(int argc, char *argv[], char *envp[])
{
@@ -359,9 +361,9 @@
first_scan = 0;
}
+#ifdef DMALLOC
malloc_area = sbrk(0);
-#ifdef DMALLOC
DEBUG1( "lpd: LOOP START - sbrk 0x%lx", (long)malloc_area );
{
extern int dmalloc_outfile_fd;
@@ -979,7 +981,6 @@
* libwrap/tcp_wrappers:
* draht@suse.de, Mon Jan 28 2002
*/
@ -8,7 +29,7 @@
struct request_info wrap_req;
request_init(&wrap_req, RQ_DAEMON, "lpd" , RQ_FILE, newsock, NULL);
@@ -993,7 +992,6 @@
@@ -993,7 +994,6 @@
close( newsock );
return;
}

View File

@ -0,0 +1,25 @@
--- src/common/utilities.c.orig
+++ src/common/utilities.c
@@ -600,22 +600,6 @@
return( n );
}
-
-char *Brk_check_size( void )
-{
- static char b[128];
- static char* Top_of_mem; /* top of allocated memory */
- char *s = sbrk(0);
- int v = s - Top_of_mem;
- if( Top_of_mem == 0 ){
- plp_snprintf(b, sizeof(b), "BRK: initial value 0x%lx", Cast_ptr_to_long(s) );
- } else {
- plp_snprintf(b, sizeof(b), "BRK: new value 0x%lx, increment %d", Cast_ptr_to_long(s), v );
- }
- Top_of_mem = s;
- return(b);
-}
-
char *mystrncat( char *s1, const char *s2, int len )
{
int size;

View File

@ -0,0 +1,10 @@
--- src/include/utilities.h.orig
+++ src/include/utilities.h
@@ -54,7 +54,6 @@
int plp_sleep( int i );
int Get_max_servers( void );
int Get_max_fd( void );
-char *Brk_check_size( void );
char *mystrncat( char *s1, const char *s2, int len );
char *mystrncpy( char *s1, const char *s2, int len );
int Get_nonblock_io( int fd );