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

Nathanael Nerode neroden-guest at costa.debian.org
Mon Sep 26 04:09:39 UTC 2005


Author: neroden-guest
Date: 2005-09-26 04:09:39 +0000 (Mon, 26 Sep 2005)
New Revision: 249

Modified:
   pinfo/branches/cxx/src/manual.cxx
   pinfo/branches/cxx/src/manual.h
   pinfo/branches/cxx/src/utils.cxx
   pinfo/branches/cxx/src/utils.h
   pinfo/branches/cxx/src/video.cxx
   pinfo/branches/cxx/src/video.h
Log:
Convert lots of passers of 'string' to pass const string& (but not the
ones which immediately modify their received variable).


Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/manual.cxx	2005-09-26 04:09:39 UTC (rev 249)
@@ -158,7 +158,7 @@
  * manual sections.
  */
 static bool
-is_in_manlinks(const vector<string>& manlinks, string to_find)
+is_in_manlinks(const vector<string>& manlinks, const string& to_find)
 {
 	/* Normalize case */
 	string to_find_uppercase = string_toupper(to_find);
@@ -290,7 +290,7 @@
 
 /* initializes hyperlinks in manual */
 static void
-man_initializelinks(string line, int line_num, int carry)
+man_initializelinks(const string& line, int line_num, int carry)
 {
 	typeof(manuallinks.size()) initialManualLinks = manuallinks.size();
 	/******************************************************************************
@@ -685,7 +685,7 @@
 
 /* print a manual line */
 static void
-mvaddstr_manual(int y, int x, string my_str)
+mvaddstr_manual(int y, int x, const string & my_str)
 {
 	static string strippedline_string;
 	if ((h_regexp.size() > 0) || regex_is_current) {
@@ -1484,7 +1484,7 @@
 
 /* this is something like main() function for the manual viewer code.  */
 int
-handlemanual(string name)
+handlemanual(const string& name)
 {
 	int return_value;
 	struct stat statbuf;

Modified: pinfo/branches/cxx/src/manual.h
===================================================================
--- pinfo/branches/cxx/src/manual.h	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/manual.h	2005-09-26 04:09:39 UTC (rev 249)
@@ -25,6 +25,6 @@
 #include <string>
 
 /* passes control to the manual code */
-int handlemanual (std::string);
+int handlemanual (const std::string &);
 
 #endif

Modified: pinfo/branches/cxx/src/utils.cxx
===================================================================
--- pinfo/branches/cxx/src/utils.cxx	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/utils.cxx	2005-09-26 04:09:39 UTC (rev 249)
@@ -337,7 +337,7 @@
  * with separator in between them, the original string will be recovered.
  */
 vector<string>
-string_explode(string to_explode, string::value_type separator) {
+string_explode(const string& to_explode, string::value_type separator) {
 	vector<string> result;
 	
 	string::size_type old_idx = 0;

Modified: pinfo/branches/cxx/src/utils.h
===================================================================
--- pinfo/branches/cxx/src/utils.h	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/utils.h	2005-09-26 04:09:39 UTC (rev 249)
@@ -73,7 +73,8 @@
 
 /* Explode a string into a vector */
 std::vector<std::string>
-string_explode(std::string to_explode, std::string::value_type separator);
+string_explode(const std::string & to_explode,
+               std::string::value_type separator);
 
 /* Return a string converted to uppercase */
 std::string string_toupper (std::string s);

Modified: pinfo/branches/cxx/src/video.cxx
===================================================================
--- pinfo/branches/cxx/src/video.cxx	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/video.cxx	2005-09-26 04:09:39 UTC (rev 249)
@@ -35,7 +35,7 @@
  * Used for internationalization of info headers.
  */
 static void
-substitutestring(string& strbuf, string find, string replace) {
+substitutestring(string& strbuf, const string& find, const string& replace) {
  	string::size_type loc = strbuf.find(find);
 	if (loc != string::npos) {
 		strbuf.replace(loc, find.length(), replace);
@@ -46,7 +46,7 @@
  * Print the header line.
  */
 void
-addtopline(const string type, string::size_type column)
+addtopline(const string& type, string::size_type column)
 {
 	string strbuf = type;
 	if (strbuf[strbuf.length() - 1] == '\n') {
@@ -82,7 +82,8 @@
  *  Does not alter the string passed to it.
  */
 static void
-info_addstring(int y, string::size_type x, string txt, string::size_type column)
+info_addstring(int y, string::size_type x, const string& txt,
+               string::size_type column)
 {
   /* Use maxx and mvaddnstr to force clipping.
    * Fairly blunt instrument, but the best I could come up with.

Modified: pinfo/branches/cxx/src/video.h
===================================================================
--- pinfo/branches/cxx/src/video.h	2005-09-26 04:02:59 UTC (rev 248)
+++ pinfo/branches/cxx/src/video.h	2005-09-26 04:09:39 UTC (rev 249)
@@ -36,5 +36,5 @@
 /* prints selected note option */
 void mvaddstr_note_selected (int y, int x, char *line, char *nline, int linenumber);
 /* adds top line of info page */
-void addtopline (std::string type, std::string::size_type column);
+void addtopline (const std::string& type, std::string::size_type column);
 #endif




More information about the Pinfo-devel mailing list