[Pinfo-devel] r207 - pinfo/branches/cxx/src

Nathanael Nerode neroden-guest at costa.debian.org
Thu Sep 8 11:33:05 UTC 2005


Author: neroden-guest
Date: 2005-09-08 11:33:04 +0000 (Thu, 08 Sep 2005)
New Revision: 207

Modified:
   pinfo/branches/cxx/src/mainfunction.cxx
Log:
Replace two of the (few) remaining uses of malloc with new/delete.


Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-09-08 11:28:45 UTC (rev 206)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-09-08 11:33:04 UTC (rev 207)
@@ -407,7 +407,8 @@
 						starttokenpos = ftell(fd);
 
 						char *tmp;
-						tmp = (char*)xmalloc(filelen - starttokenpos + 10);	/* read data */
+						tmp = new char[filelen - starttokenpos + 10];
+						/* read data */
 						fread(tmp, 1, filelen - starttokenpos, fd);
 						tmp[filelen - starttokenpos + 1] = 0;
 
@@ -468,7 +469,7 @@
 							{
 								if (tmp)	/* free tmp buffer */
 								{
-									xfree(tmp);
+									delete tmp;
 									tmp = 0;
 								}
 								break;
@@ -476,7 +477,7 @@
 						}	/* end: if (tokenpos) */
 						if (tmp)	/* free tmp buffer */
 						{
-							xfree(tmp);
+							delete tmp;
 							tmp = 0;
 						}
 					}		/* end: indirect file loop */
@@ -489,7 +490,6 @@
 					long filepos = ftell(id);
 					long tokenpos;
 					long starttokenpos;
-					char *tmp;
 
 					fseek(id, 0, SEEK_END);	/* calculate filelength */
 					filelen = ftell(id);
@@ -500,8 +500,9 @@
 					/* remember the number of skipped bytes.*/
 					starttokenpos = ftell(id);
 
+					char *tmp;
 					/* read data */
-					tmp = (char*)xmalloc(filelen - starttokenpos + 10);
+					tmp = new char[filelen - starttokenpos + 10]; /* FIXME */
 					fread(tmp, 1, filelen - starttokenpos, id);
 					tmp[filelen - starttokenpos + 1] = 0;
 
@@ -560,7 +561,7 @@
 					}		/* end: if (tokenpos) <--> token found */
 					if (tmp)	/* free tmp buffer */
 					{
-						xfree(tmp);
+						delete tmp;
 						tmp = 0;
 					}
 				}		/* end: if (!indirect) */




More information about the Pinfo-devel mailing list