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

Nathanael Nerode neroden-guest at costa.debian.org
Fri Sep 2 03:41:57 UTC 2005


Author: neroden-guest
Date: 2005-09-02 03:41:57 +0000 (Fri, 02 Sep 2005)
New Revision: 124

Modified:
   pinfo/branches/cxx/src/datatypes.cxx
   pinfo/branches/cxx/src/datatypes.h
Log:
And convert InfoHistory to std::string.


Modified: pinfo/branches/cxx/src/datatypes.cxx
===================================================================
--- pinfo/branches/cxx/src/datatypes.cxx	2005-09-02 03:37:31 UTC (rev 123)
+++ pinfo/branches/cxx/src/datatypes.cxx	2005-09-02 03:41:57 UTC (rev 124)
@@ -90,10 +90,8 @@
 addinfohistory(const char *file, const char *node, int cursor, int menu, int pos)
 {
 	InfoHistory my_hist;
-	my_hist.node = (char*)xmalloc(strlen(node) + 1);
-	strcpy(my_hist.node, node);
-	my_hist.file = (char*)xmalloc(strlen(file) + 1);
-	strcpy(my_hist.file, file);
+	my_hist.node = node;
+	my_hist.file = file;
 	my_hist.pos = pos;
 	my_hist.cursor = cursor;
 	my_hist.menu = menu;
@@ -109,14 +107,6 @@
 	if (infohistory.empty()) {
 		return;
 	}
-	if (infohistory[infohistory.size() - 1].node)	{
-		xfree(infohistory[infohistory.size() - 1].node);
-		infohistory[infohistory.size() - 1].node = 0;
-	}
-	if (infohistory[infohistory.size() - 1].file) {
-		xfree(infohistory[infohistory.size() - 1].file);
-		infohistory[infohistory.size() - 1].file = 0;
-	}
 	infohistory.pop_back();
 }
 

Modified: pinfo/branches/cxx/src/datatypes.h
===================================================================
--- pinfo/branches/cxx/src/datatypes.h	2005-09-02 03:37:31 UTC (rev 123)
+++ pinfo/branches/cxx/src/datatypes.h	2005-09-02 03:41:57 UTC (rev 124)
@@ -61,8 +61,8 @@
 
 typedef struct InfoHistory
 {
-	char *node;	/* node */
-	char *file;	/* file associated with given node */
+	std::string node;	/* node */
+	std::string file;	/* file associated with given node */
 	int pos;		/* pos offset in viewed nodes */
 	int cursor;	/* cursor offsets in viewed nodes */
 	int menu;		/* menu position (in sequential reading) in viewed node */




More information about the Pinfo-devel mailing list