Commit 61ead850 authored by rswindell's avatar rswindell
Browse files

Fixed malloc/realloc warnings on FreeBSD by #including stdlib.h instead of malloc.h.

parent 90f0d12f
......@@ -52,11 +52,13 @@
#ifndef VTOOLSD
/* FreeBSD uses <stdlib.h> instead of <malloc.h> */
#ifndef __FreeBSD__
#include <malloc.h> /* malloc prototype */
#ifdef __FreeBSD__
#include <stdlib.h>
#else
#include <malloc.h> /* malloc prototype */
#endif
#include <string.h> /* memcpy prototype */
#endif
#include <string.h> /* memcpy prototype */
#endif /* !VTOOLSD */
#define os_malloc malloc
#define rb_malloc malloc
......
......@@ -20,7 +20,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <share.h>
#include <malloc.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
......@@ -31,6 +30,10 @@
#include <mem.h>
#endif
#ifndef __FreeBSD__
#include <malloc.h>
#endif
#include "sbbs.h" /* load_cfg() */
#include "smbwrap.h" /* lock/unlock() */
#include "sbbswrap.h" /* glob_t */
......
......@@ -37,7 +37,9 @@
/* ANSI */
#ifndef __FreeBSD__
#ifdef __FreeBSD__
#include <stdlib.h> /* malloc/realloc/free is defined here */
#else
#include <malloc.h>
#endif
......@@ -46,7 +48,9 @@
char HUGE16* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
{
char HUGE16* buf=NULL,HUGE16* lzhbuf,HUGE16* p;
char HUGE16* buf=NULL;
char HUGE16* lzhbuf;
char HUGE16* p;
ushort xlat;
int i,lzh;
long l=0,lzhlen,length;
......@@ -72,7 +76,7 @@ char HUGE16* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
length-=2;
if(length<1)
continue;
if((lzhbuf=LMALLOC(length))==NULL) {
if((lzhbuf=(char HUGE16*)LMALLOC(length))==NULL) {
sprintf(smb->last_error
,"malloc failure of %ld bytes for LZH buffer"
,length);
......@@ -80,7 +84,7 @@ char HUGE16* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
}
smb_fread(lzhbuf,length,smb->sdt_fp);
lzhlen=*(long*)lzhbuf;
if((p=REALLOC(buf,l+lzhlen+3L))==NULL) {
if((p=(char HUGE16*)REALLOC(buf,l+lzhlen+3L))==NULL) {
sprintf(smb->last_error
,"realloc failure of %ld bytes for text buffer"
,l+lzhlen+3L);
......@@ -93,7 +97,7 @@ char HUGE16* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
l+=lzhlen;
}
else {
if((p=REALLOC(buf,l+length+3L))==NULL) {
if((p=(char HUGE16*)REALLOC(buf,l+length+3L))==NULL) {
sprintf(smb->last_error
,"realloc failure of %ld bytes for text buffer"
,l+length+3L);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment