[Pinfo-devel] r251 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Mon Sep 26 04:38:30 UTC 2005
Author: neroden-guest
Date: 2005-09-26 04:38:29 +0000 (Mon, 26 Sep 2005)
New Revision: 251
Modified:
pinfo/branches/cxx/src/initializelinks.cxx
pinfo/branches/cxx/src/initializelinks.h
Log:
More of the same. Any performance losses due to extra copying after
switching to std::string should be gone now.
Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx 2005-09-26 04:25:04 UTC (rev 250)
+++ pinfo/branches/cxx/src/initializelinks.cxx 2005-09-26 04:38:29 UTC (rev 251)
@@ -36,7 +36,7 @@
return (a.col < b.col);
}
-void
+static void
sort_hyperlinks_from_current_line(
typeof(hyperobjects.begin()) startlink,
typeof(hyperobjects.begin()) endlink)
@@ -48,14 +48,14 @@
* checks if an item belongs to tag table. returns 1 on success and 0 on
* failure. It should be optimised...
*/
-inline int
-exists_in_tag_table(const string item)
+static inline bool
+exists_in_tag_table(const string& item)
{
int result = gettagtablepos(item);
if (result != -1)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
/*
@@ -88,7 +88,7 @@
* FIXME: This is really not a sufficient test for a URL.
*/
string::size_type
-findurlend(const string str, string::size_type pos)
+findurlend(const string& str, string::size_type pos)
{
const char* const allowedchars =
"QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-_/~.%=|:@";
@@ -111,8 +111,8 @@
* is_note is true (== NOTE_DOT) if we're looking for a note, and
* false (== MENU_DOT) if we're looking for a menu.
*/
-string::size_type
-finddot(string str, string::size_type pos, bool is_note)
+static string::size_type
+finddot(const string & str, string::size_type pos, bool is_note)
{
string::size_type idx = pos;
while (isspace(str[idx])) {
@@ -139,7 +139,7 @@
* Treat string as starting with pos.
*/
string::size_type
-findemailstart(string str, string::size_type pos) {
+findemailstart(const string & str, string::size_type pos) {
const char * const allowedchars = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-_/~.%=|:";
const string my_str = str.substr(pos);
const string::size_type at_idx = my_str.find('@');
@@ -157,7 +157,7 @@
}
void
-initializelinks(const string line1, const string line2, int line)
+initializelinks(const string & line1, const string & line2, int line)
{
bool changed;
Modified: pinfo/branches/cxx/src/initializelinks.h
===================================================================
--- pinfo/branches/cxx/src/initializelinks.h 2005-09-26 04:25:04 UTC (rev 250)
+++ pinfo/branches/cxx/src/initializelinks.h 2005-09-26 04:38:29 UTC (rev 251)
@@ -23,18 +23,18 @@
#ifndef __INITIALIZELINKS_H
#define __INITIALIZELINKS_H
/* initializes node links. */
-void initializelinks (const std::string line1,
- const std::string line2,
+void initializelinks (const std::string & line1,
+ const std::string & line2,
int line);
/*
* scans for url end in given url-string (from pos).
* returns index of found place.
*/
-std::string::size_type findurlend (std::string str,
+std::string::size_type findurlend (const std::string & str,
std::string::size_type pos = 0);
/* scans for the beginning of username. Returns its index. */
-std::string::size_type findemailstart (std::string str,
+std::string::size_type findemailstart (const std::string & str,
std::string::size_type pos = 0);
/*
More information about the Pinfo-devel
mailing list