From 005c1275955e99231e241a0d5b35669650365e1f Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 4 Dec 2003 07:06:12 +0000
Subject: [PATCH] Fixed the gcc warning regarding strlen - needed to #include
 string.h. Changed all the malloc/realloc/free stuff to std C (no legacy
 macros).

---
 src/smblib/smbtxt.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/smblib/smbtxt.c b/src/smblib/smbtxt.c
index 1edb8400e8..0bd2cb18d2 100644
--- a/src/smblib/smbtxt.c
+++ b/src/smblib/smbtxt.c
@@ -36,12 +36,8 @@
  ****************************************************************************/
 
 /* ANSI */
-
-#ifdef __unix__
-	#include <stdlib.h>		/* malloc/realloc/free is defined here */
-#else
-	#include <malloc.h>
-#endif
+#include <stdlib.h>	/* malloc/realloc/free */
+#include <string.h>	/* strlen */
 
 /* SMB-specific */
 #include "smblib.h"
@@ -57,7 +53,7 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
 	int		lzh;	/* BOOL */
 	long	l=0,lzhlen,length;
 
-	if((buf=malloc(sizeof(char)))==NULL) {
+	if((buf=(char*)malloc(sizeof(char)))==NULL) {
 		sprintf(smb->last_error
 			,"malloc failure of %u bytes for buffer"
 			,sizeof(char));
@@ -70,7 +66,7 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
 			continue;
 		str=(char*)msg->hfield_dat[i];
 		length=strlen(str)+2;	/* +2 for crlf */
-		if((p=(char*)REALLOC(buf,l+length+1))==NULL) {
+		if((p=(char*)realloc(buf,l+length+1))==NULL) {
 			sprintf(smb->last_error
 				,"realloc failure of %ld bytes for comment buffer"
 				,l+length+1);
@@ -111,7 +107,7 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
 			length-=sizeof(xlat);
 			if(length<1)
 				continue;
-			if((lzhbuf=(char*)LMALLOC(length))==NULL) {
+			if((lzhbuf=(char*)malloc(length))==NULL) {
 				sprintf(smb->last_error
 					,"malloc failure of %ld bytes for LZH buffer"
 					,length);
@@ -119,20 +115,20 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
 			}
 			smb_fread(smb,lzhbuf,length,smb->sdt_fp);
 			lzhlen=*(long*)lzhbuf;
-			if((p=(char*)REALLOC(buf,l+lzhlen+3L))==NULL) {
+			if((p=(char*)realloc(buf,l+lzhlen+3L))==NULL) {
 				sprintf(smb->last_error
 					,"realloc failure of %ld bytes for text buffer"
 					,l+lzhlen+3L);
-				FREE(lzhbuf);
+				free(lzhbuf);
 				return(buf); 
 			}
 			buf=p;
 			lzh_decode((char*)lzhbuf,length,(char*)buf+l);
-			FREE(lzhbuf);
+			free(lzhbuf);
 			l+=lzhlen; 
 		}
 		else {
-			if((p=(char*)REALLOC(buf,l+length+3L))==NULL) {
+			if((p=(char*)realloc(buf,l+length+3L))==NULL) {
 				sprintf(smb->last_error
 					,"realloc failure of %ld bytes for text buffer"
 					,l+length+3L);
@@ -160,5 +156,5 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
 void SMBCALL smb_freemsgtxt(char* buf)
 {
 	if(buf!=NULL)
-		FREE(buf);
+		free(buf);
 }
-- 
GitLab