[Pinfo-devel] r96 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Tue Aug 30 13:30:00 UTC 2005
Author: neroden-guest
Date: 2005-08-30 13:30:00 +0000 (Tue, 30 Aug 2005)
New Revision: 96
Modified:
pinfo/branches/cxx/src/initializelinks.cxx
pinfo/branches/cxx/src/manual.cxx
pinfo/branches/cxx/src/parse_config.cxx
Log:
Eliminate a few strdups by use of const char*.
Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx 2005-08-30 13:23:25 UTC (rev 95)
+++ pinfo/branches/cxx/src/initializelinks.cxx 2005-08-30 13:30:00 UTC (rev 96)
@@ -69,9 +69,7 @@
inline int
exists_in_tag_table(const string item)
{
- char * item_working = strdup(item.c_str());
- int result = gettagtablepos(item_working);
- xfree(item_working);
+ int result = gettagtablepos(item.c_str());
if (result != -1)
return 1;
else
Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx 2005-08-30 13:23:25 UTC (rev 95)
+++ pinfo/branches/cxx/src/manual.cxx 2005-08-30 13:30:00 UTC (rev 96)
@@ -1518,8 +1518,8 @@
a searched regexp to highlight */
for (int j = 0; j < maxregexp; j++)
{
- char* strippedline = strdup(strippedline_string.c_str());
- char* tmpstr = strippedline;
+ const char* strippedline = strippedline_string.c_str();
+ const char* tmpstr = strippedline;
while (!regexec(&h_regexp[j], tmpstr, 1, pmatch, 0))
{
int n = pmatch[0].rm_eo - pmatch[0].rm_so;
@@ -1536,7 +1536,6 @@
tmpstr = tmpstr + pmatch[0].rm_eo;
move(curY, curX);
}
- free(strippedline);
}
}
#endif
Modified: pinfo/branches/cxx/src/parse_config.cxx
===================================================================
--- pinfo/branches/cxx/src/parse_config.cxx 2005-08-30 13:23:25 UTC (rev 95)
+++ pinfo/branches/cxx/src/parse_config.cxx 2005-08-30 13:30:00 UTC (rev 96)
@@ -665,13 +665,12 @@
{
string tmpstr = temp;
string tmpstr2 = remove_quotes(tmpstr);
- char *tmp = strdup(tmpstr2.c_str());
+ const char *tmp = tmpstr2.c_str();
if (!h_regexp_num)
h_regexp = (regex_t*)malloc(sizeof(regex_t));
else
h_regexp = (regex_t*)realloc(h_regexp, sizeof(regex_t) *(h_regexp_num + 1));
regcomp(&h_regexp[h_regexp_num], tmp, 0);
- free(tmp);
h_regexp_num++;
}
else
More information about the Pinfo-devel
mailing list