From 00216e16c717470ae53dbbfd1d52850d1b102e29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Bron?= Date: Fri, 23 Aug 2013 17:30:34 +0200 Subject: [PATCH] Issue 3531: replaced function argument 'string' by 'const string&' where it makes sense to avoid unnecessary copying of 'string' objects. Measurements on x86_64 (i7-2760QM, 2.40GHz) Fedora 19 with g++ 4.8.1, with configure --enable-optimising --disable-debugging; tests run 10 times, average elapsed time compared (/usr/bin/time) * Bach, Concerto in E major or violin and strings, BWV 1042 (Mutopia source), 38 pages: $ lilypond score.ly -> master: 15.4s, with patch: -0.1% * lilypond regression tests (1153 .ly files): $ lilypond *.ly -> master: 276.6s, with patch: -2.5% --- flower/file-name.cc | 4 ++-- flower/file-path.cc | 12 ++++++------ flower/include/file-name.hh | 2 +- flower/include/file-path.hh | 12 ++++++------ flower/include/international.hh | 2 +- flower/include/std-string.hh | 4 ++-- flower/include/std-vector.hh | 2 +- flower/include/string-convert.hh | 14 +++++++------- flower/include/warn.hh | 20 ++++++++++---------- flower/international.cc | 2 +- flower/std-string.cc | 6 +++--- flower/string-convert.cc | 18 +++++++++--------- flower/warn.cc | 22 +++++++++++----------- lily/all-font-metrics.cc | 8 ++++---- lily/audio-item.cc | 2 +- lily/auto-change-iterator.cc | 4 ++-- lily/axis-group-interface.cc | 2 +- lily/change-iterator.cc | 2 +- lily/context.cc | 10 +++++----- lily/control-track-performer.cc | 4 ++-- lily/file-name-map.cc | 4 ++-- lily/font-metric.cc | 10 ++-------- lily/function-documentation.cc | 10 +++++----- lily/global-context.cc | 2 +- lily/gregorian-ligature.cc | 2 +- lily/grob.cc | 4 ++-- lily/includable-lexer.cc | 4 ++-- lily/include/all-font-metrics.hh | 8 ++++---- lily/include/audio-item.hh | 2 +- lily/include/axis-group-interface.hh | 2 +- lily/include/change-iterator.hh | 2 +- lily/include/context.hh | 10 +++++----- lily/include/file-name-map.hh | 2 +- lily/include/font-metric.hh | 6 +++--- lily/include/global-context.hh | 2 +- lily/include/grob.hh | 4 ++-- lily/include/includable-lexer.hh | 4 ++-- lily/include/input.hh | 14 +++++++------- lily/include/lily-guile-macros.hh | 6 +++--- lily/include/lily-guile.hh | 6 +++--- lily/include/lily-lexer.hh | 14 +++++++------- lily/include/lily-parser.hh | 14 +++++++------- lily/include/lilypond-version.hh | 2 +- lily/include/midi-chunk.hh | 2 +- lily/include/midi-stream.hh | 4 ++-- lily/include/misc.hh | 2 +- lily/include/modified-font-metric.hh | 4 ++-- lily/include/note-head.hh | 2 +- lily/include/open-type-font.hh | 10 +++++----- lily/include/output-def.hh | 2 +- lily/include/pango-font.hh | 4 ++-- lily/include/paper-outputter.hh | 2 +- lily/include/relocate.hh | 8 ++++---- lily/include/rest.hh | 2 +- lily/include/slur-configuration.hh | 2 +- lily/include/slur-proto-engraver.hh | 4 ++-- lily/include/source-file.hh | 6 +++--- lily/include/tie-configuration.hh | 6 +++--- lily/input.cc | 14 +++++++------- lily/lexer.ll | 6 +++--- lily/lily-guile.cc | 8 ++++---- lily/lily-lexer.cc | 8 ++++---- lily/lily-parser.cc | 12 ++++++------ lily/lilypond-version.cc | 2 +- lily/main.cc | 4 ++-- lily/midi-chunk.cc | 2 +- lily/midi-stream.cc | 4 ++-- lily/misc.cc | 4 ++-- lily/modified-font-metric.cc | 6 +++--- lily/note-head.cc | 2 +- lily/open-type-font.cc | 10 +++++----- lily/output-def.cc | 2 +- lily/pango-font.cc | 6 +++--- lily/paper-outputter.cc | 2 +- lily/parser.yy | 2 +- lily/relocate.cc | 16 ++++++++-------- lily/rest.cc | 2 +- lily/slur-configuration.cc | 2 +- lily/slur-proto-engraver.cc | 4 ++-- lily/source-file.cc | 6 +++--- lily/staff-performer.cc | 24 ++++++++++++------------ lily/tie-configuration.cc | 6 +++--- lily/ttf.cc | 2 +- 83 files changed, 248 insertions(+), 254 deletions(-) diff --git a/flower/file-name.cc b/flower/file-name.cc index c24c0731e4..1746c2c28d 100644 --- a/flower/file-name.cc +++ b/flower/file-name.cc @@ -51,7 +51,7 @@ using namespace std; #ifdef __CYGWIN__ static string -dos_to_posix (string file_name) +dos_to_posix (const string &file_name) { char buf[PATH_MAX] = ""; char s[PATH_MAX] = {0}; @@ -78,7 +78,7 @@ slashify (string file_name) } string -dir_name (string const file_name) +dir_name (const string &file_name) { string s = file_name; s = slashify (s); diff --git a/flower/file-path.cc b/flower/file-path.cc index d0dd3a1f99..b19732d15e 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -47,13 +47,13 @@ File_path::directories () const #include void -File_path::parse_path (string p) +File_path::parse_path (const string &p) { concat (dirs_, string_split (p, PATHSEP)); } bool -is_file (string file_name) +is_file (const string &file_name) { #if !STAT_MACROS_BROKEN struct stat sbuf; @@ -106,7 +106,7 @@ directory, in this order. The file name if found, or empty string if not found. */ string -File_path::find (string name) const +File_path::find (const string &name) const { if (!name.length () || (name == "-")) return name; @@ -146,7 +146,7 @@ File_path::find (string name) const where EXT is from EXTENSIONS. */ string -File_path::find (string name, char const *extensions[]) +File_path::find (const string &name, char const *extensions[]) { if (name.empty () || name == "-") return name; @@ -195,13 +195,13 @@ File_path::to_string () const } void -File_path::append (string str) +File_path::append (const string &str) { dirs_.push_back (str); } void -File_path::prepend (string str) +File_path::prepend (const string &str) { dirs_.insert (dirs_.begin (), str); } diff --git a/flower/include/file-name.hh b/flower/include/file-name.hh index b30dd9cd5b..4822783fc6 100644 --- a/flower/include/file-name.hh +++ b/flower/include/file-name.hh @@ -23,7 +23,7 @@ #include "std-vector.hh" #include "std-string.hh" -std::string dir_name (std::string file_name); +std::string dir_name (const std::string &file_name); std::string get_working_directory (); class File_name diff --git a/flower/include/file-path.hh b/flower/include/file-path.hh index 29ca17f246..8c8049391d 100644 --- a/flower/include/file-path.hh +++ b/flower/include/file-path.hh @@ -38,16 +38,16 @@ class File_path public: vector directories () const; - string find (string name) const; - string find (string name, char const *extensions[]); + string find (const string &name) const; + string find (const string &name, char const *extensions[]); string to_string () const; bool try_append (string str); - void append (string str); - void parse_path (string); - void prepend (string str); + void append (const string&); + void parse_path (const string&); + void prepend (const string&); }; -bool is_file (string file_name); +bool is_file (const string &file_name); bool is_dir (string file_name); #endif /* FILE_PATH */ diff --git a/flower/include/international.hh b/flower/include/international.hh index 6dd46c28e9..5797a293f7 100644 --- a/flower/include/international.hh +++ b/flower/include/international.hh @@ -43,7 +43,7 @@ string _ (char const *ch); */ string _f (char const *format, ...) __attribute__ ((format (printf, 1, 2))); -string _f (char const *format, string s, string s2 = "", string s3 = ""); +string _f (char const *format, const string &s, const string &s2 = "", const string &s3 = ""); /** va_list version of _f */ diff --git a/flower/include/std-string.hh b/flower/include/std-string.hh index 5b7d2af11d..6b6e8ef972 100644 --- a/flower/include/std-string.hh +++ b/flower/include/std-string.hh @@ -39,7 +39,7 @@ using namespace std; typedef size_t ssize; #define NPOS string::npos -string to_string (string s); +string to_string (const string&); string to_string (char c, int n = 1); string to_string (int i, char const *format = 0); string to_string (double f, char const *format = 0); @@ -53,7 +53,7 @@ __attribute__ ((format (printf, 1, 2))); string &replace_all (string *str, string const &find, string const &replace); string &replace_all (string *str, char find, char replace); -char *string_copy (string s); +char *string_copy (const string &s); int string_compare (string const &, string const &); diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index dd276df186..e7f29a8fcb 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -258,7 +258,7 @@ junk_pointers (vector &v) } vector string_split (string str, char c); -string string_join (vector const &strs, string infix); +string string_join (vector const &strs, const string &infix); #define iterof(i,s) typeof((s).begin()) i((s).begin()) diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index 396eee2f91..6b4fba023f 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -19,19 +19,19 @@ class String_convert static int hex2nibble (Byte byte); static Byte nibble2hex_byte (Byte byte); public: - static string pad_to (string s, size_t length); + static string pad_to (const string &s, size_t length); static string bool_string (bool b); static string bin2hex (Byte bin_char); - static string bin2hex (string bin_string); - static int bin2int (string bin_string); - static unsigned bin2unsigned (string bin_string); + static string bin2hex (const string &bin_string); + static int bin2int (const string &bin_string); + static unsigned bin2unsigned (const string &bin_string); static string char_string (char c, int n); - static int dec2int (string dec_string); - static double dec2double (string dec_string); + static int dec2int (const string &dec_string); + static double dec2double (const string &dec_string); static string double_string (double f, char const *fmt = 0); static string form_string (char const *format, ...) __attribute__ ((format (printf, 1, 2))); static string vform_string (char const *format, va_list args); - static string hex2bin (string str); + static string hex2bin (const string &str); static string int_string (int i, char const *fmt = 0); static string unsigned_string (unsigned); static string unsigned_long_string (unsigned long); diff --git a/flower/include/warn.hh b/flower/include/warn.hh index 25240113ca..333e95a94e 100644 --- a/flower/include/warn.hh +++ b/flower/include/warn.hh @@ -44,25 +44,25 @@ extern int loglevel; extern bool warning_as_error; /* output messages, in decreasing order of importance */ -void error (string s, string location = ""); // Fatal error, exits lilypond! -void programming_error (string s, string location = ""); -void non_fatal_error (string, string location = ""); -void warning (string s, string location = ""); -void basic_progress (string s, string location = ""); +void error (string s, const string &location = ""); // Fatal error, exits lilypond! +void programming_error (const string &s, const string &location = ""); +void non_fatal_error (const string&, const string &location = ""); +void warning (const string &s, const string &location = ""); +void basic_progress (const string &s, const string &location = ""); /* progress_indication does by default *NOT* start on a new line */ -void progress_indication (string s, bool newline = false, string location = ""); -void message (string s, bool newline = true, string location = ""); -void debug_output (string s, bool newline = true, string location = ""); +void progress_indication (const string &s, bool newline = false, const string &location = ""); +void message (const string &s, bool newline = true, const string &location = ""); +void debug_output (const string &s, bool newline = true, const string &location = ""); /* Helper functions that always print out the message. Callers should ensure that the loglevel is obeyed */ -void print_message (int level, string location, string s, bool newline = true); +void print_message (int level, const string &location, string s, bool newline = true); bool is_loglevel (int level); void set_loglevel (int level); void set_loglevel (string level); -void expect_warning (string msg); +void expect_warning (const string &msg); void check_expected_warnings (); #endif /* WARN_HH */ diff --git a/flower/international.cc b/flower/international.cc index cbdcf58d6e..2e6a09df9f 100644 --- a/flower/international.cc +++ b/flower/international.cc @@ -55,7 +55,7 @@ v_f (char const *format, va_list args) } string -_f (char const *format, string s, string s2, string s3) +_f (char const *format, const string &s, const string &s2, const string &s3) { return String_convert::form_string (gettext (format), s.c_str (), s2.c_str (), s3.c_str ()); diff --git a/flower/std-string.cc b/flower/std-string.cc index d2c2d624d2..7dc9d47311 100644 --- a/flower/std-string.cc +++ b/flower/std-string.cc @@ -21,7 +21,7 @@ #include "string-convert.hh" string -to_string (string s) +to_string (const string &s) { return s; } @@ -106,7 +106,7 @@ replace_all (string *str, char find, char replace) } char * -string_copy (string s) +string_copy (const string &s) { ssize len = s.length (); char *dest = new char[len + 1]; @@ -144,7 +144,7 @@ string_split (string str, char c) } string -string_join (vector const &strs, string infix) +string_join (vector const &strs, const string &infix) { string result; for (vsize i = 0; i < strs.size (); i++) diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 68e6a0c0b8..eebcd92708 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -43,7 +43,7 @@ String_convert::bin2hex (Byte bin_char) } string -String_convert::bin2hex (string bin_string) +String_convert::bin2hex (const string &bin_string) { string str; Byte const *byte = (Byte const *)bin_string.data (); @@ -56,13 +56,13 @@ String_convert::bin2hex (string bin_string) } int -String_convert::bin2int (string bin_string) +String_convert::bin2int (const string &bin_string) { return bin2unsigned (bin_string); } unsigned -String_convert::bin2unsigned (string bin_string) +String_convert::bin2unsigned (const string &bin_string) { assert (bin_string.length () <= (int)sizeof (unsigned)); @@ -76,7 +76,7 @@ String_convert::bin2unsigned (string bin_string) } int -String_convert::dec2int (string dec_string) +String_convert::dec2int (const string &dec_string) { if (!dec_string.length ()) return 0; @@ -100,7 +100,7 @@ String_convert::i64_string (I64 i64, char const *fmt) } // breendet imp from string double -String_convert::dec2double (string dec_string) +String_convert::dec2double (const string &dec_string) { if (!dec_string.length ()) return 0; @@ -134,7 +134,7 @@ String_convert::hex2bin (string hex_string, string &bin_string_r) } string -String_convert::hex2bin (string hex_string) +String_convert::hex2bin (const string &hex_string) { string str; @@ -352,7 +352,7 @@ String_convert::unsigned_long_string (unsigned long ul) } string -String_convert::pad_to (string s, size_t n) +String_convert::pad_to (const string &s, size_t n) { return s + string (max (int (n - s.length ()), 0), ' '); } @@ -360,13 +360,13 @@ String_convert::pad_to (string s, size_t n) string String_convert::to_upper (string s) { - return strnupr ((char *)s.c_str (), s.length ()); + return strnupr (const_cast(s.c_str ()), s.length ()); } string String_convert::to_lower (string s) { - return strnlwr ((char *)s.c_str (), s.length ()); + return strnlwr (const_cast(s.c_str ()), s.length ()); } string diff --git a/flower/warn.cc b/flower/warn.cc index f3f6e1c743..52e2a42508 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -99,7 +99,7 @@ set_loglevel (string level) * expected warnings again. */ vector expected_warnings; -void expect_warning (string msg) +void expect_warning (const string &msg) { expected_warnings.push_back (msg); } @@ -119,7 +119,7 @@ void check_expected_warnings () expected_warnings.clear (); } -bool is_expected (string s) +bool is_expected (const string &s) { bool expected = false; for (vsize i = 0; i < expected_warnings.size (); i++) @@ -151,7 +151,7 @@ static bool message_newline = true; if newline is true, start the message on a new line. */ void -print_message (int level, string location, string s, bool newline) +print_message (int level, const string &location, string s, bool newline) { /* Only print the message if the current loglevel allows it: */ if (!is_loglevel (level)) @@ -178,7 +178,7 @@ print_message (int level, string location, string s, bool newline) /* Display a fatal error message. Also exits lilypond. */ void -error (string s, string location) +error (string s, const string &location) { print_message (LOG_ERROR, location, _f ("fatal error: %s", s) + "\n"); exit (1); @@ -186,7 +186,7 @@ error (string s, string location) /* Display a severe programming error message, but don't exit. */ void -programming_error (string s, string location) +programming_error (const string &s, const string &location) { if (is_expected (s)) print_message (LOG_DEBUG, location, _f ("suppressed programming error: %s", s) + "\n"); @@ -201,7 +201,7 @@ programming_error (string s, string location) /* Display a non-fatal error message, don't exit. */ void -non_fatal_error (string s, string location) +non_fatal_error (const string &s, const string &location) { if (is_expected (s)) print_message (LOG_DEBUG, location, _f ("suppressed error: %s", s) + "\n"); @@ -213,7 +213,7 @@ non_fatal_error (string s, string location) /* Display a warning message. */ void -warning (string s, string location) +warning (const string &s, const string &location) { if (is_expected (s)) print_message (LOG_DEBUG, location, _f ("suppressed warning: %s", s) + "\n"); @@ -225,21 +225,21 @@ warning (string s, string location) /* Display a success message. */ void -basic_progress (string s, string location) +basic_progress (const string &s, const string &location) { print_message (LOG_BASIC, location, s + "\n", true); } /* Display information about the progress. */ void -progress_indication (string s, bool newline, string location) +progress_indication (const string &s, bool newline, const string &location) { print_message (LOG_PROGRESS, location, s, newline); } /* Display a single info message. */ void -message (string s, bool newline, string location) +message (const string &s, bool newline, const string &location) { // Use the progress loglevel for all normal messages (including progress msg) print_message (LOG_INFO, location, s, newline); @@ -247,7 +247,7 @@ message (string s, bool newline, string location) /* Display a debug information, not necessarily on a new line. */ void -debug_output (string s, bool newline, string location) +debug_output (const string &s, bool newline, const string &location) { print_message (LOG_DEBUG, location, s, newline); } diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 36ede54bb4..cf0d4e9086 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -28,7 +28,7 @@ #include "warn.hh" Index_to_charcode_map const * -All_font_metrics::get_index_to_charcode_map (string filename, +All_font_metrics::get_index_to_charcode_map (const string &filename, int face_index, FT_Face face) { @@ -40,7 +40,7 @@ All_font_metrics::get_index_to_charcode_map (string filename, return &filename_charcode_maps_map_[key]; } -All_font_metrics::All_font_metrics (string path) +All_font_metrics::All_font_metrics (const string &path) { otf_dict_ = new Scheme_hash_table; @@ -109,7 +109,7 @@ All_font_metrics::find_pango_font (PangoFontDescription const *description, #endif Open_type_font * -All_font_metrics::find_otf (string name) +All_font_metrics::find_otf (const string &name) { SCM sname = ly_symbol2scm (name.c_str ()); SCM val; @@ -140,7 +140,7 @@ All_font_metrics::find_otf (string name) } Font_metric * -All_font_metrics::find_font (string name) +All_font_metrics::find_font (const string &name) { Font_metric *f = find_otf (name); diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 895439e784..b7a5ef2111 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -198,7 +198,7 @@ Audio_time_signature::Audio_time_signature (int beats, int one_beat) one_beat_ = one_beat; } -Audio_text::Audio_text (Audio_text::Type type, string text_string) +Audio_text::Audio_text (Audio_text::Type type, const string &text_string) { text_string_ = text_string; type_ = type; diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index b52fb16bb4..1efa379e9d 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -38,7 +38,7 @@ protected: private: SCM split_list_; Direction where_dir_; - void change_to (Music_iterator *, SCM, string); + void change_to (Music_iterator *, SCM, const string&); Moment start_moment_; Context_handle up_; @@ -47,7 +47,7 @@ private: void Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, - string to_id) + const string &to_id) { Context *current = it->get_outlet (); Context *last = 0; diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 819a32d6f4..d4d3d41022 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -485,7 +485,7 @@ Axis_group_interface::calc_pure_relevant_grobs (SCM smob) } SCM -Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, string grob_set_name) +Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, const string &grob_set_name) { extract_grob_set (me, grob_set_name.c_str (), elts); diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index 0adac3b8b3..aa505f9fe1 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -26,7 +26,7 @@ #include "warn.hh" void -Change_iterator::error (string reason) +Change_iterator::error (const string &reason) { string to_type = ly_symbol2string (get_music ()->get_property ("change-to-type")); string to_id = ly_scm2string (get_music ()->get_property ("change-to-id")); diff --git a/lily/context.cc b/lily/context.cc index 583b2eac89..8d44ca8f85 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -105,7 +105,7 @@ Context::Context () /* TODO: this shares code with find_create_context (). */ Context * -Context::create_unique_context (SCM name, string id, SCM operations) +Context::create_unique_context (SCM name, const string &id, SCM operations) { /* Don't create multiple score contexts. @@ -154,7 +154,7 @@ Context::create_unique_context (SCM name, string id, SCM operations) } Context * -Context::find_create_context (SCM n, string id, SCM operations) +Context::find_create_context (SCM n, const string &id, SCM operations) { /* Don't create multiple score contexts. @@ -361,7 +361,7 @@ Context::path_to_acceptable_context (SCM name) const Context * Context::create_context (Context_def *cdef, - string id, + const string &id, SCM ops) { infant_event_ = 0; @@ -411,7 +411,7 @@ Context::is_bottom_context () const } Context * -Context::get_default_interpreter (string context_id) +Context::get_default_interpreter (const string &context_id) { if (!is_bottom_context ()) { @@ -572,7 +572,7 @@ Context::disconnect_from_parent () */ Context * find_context_below (Context *where, - SCM type, string id) + SCM type, const string &id) { if (where->is_alias (type)) { diff --git a/lily/control-track-performer.cc b/lily/control-track-performer.cc index 84f8044b47..9b0d676870 100644 --- a/lily/control-track-performer.cc +++ b/lily/control-track-performer.cc @@ -13,7 +13,7 @@ class Control_track_performer : public Performer { Audio_staff *control_track_; - void add_text (Audio_text::Type, string); + void add_text (Audio_text::Type, const string&); TRANSLATOR_DECLARATIONS (Control_track_performer); protected: @@ -40,7 +40,7 @@ Control_track_performer::acknowledge_audio_element (Audio_element_info info) } void -Control_track_performer::add_text (Audio_text::Type text_type, string str) +Control_track_performer::add_text (Audio_text::Type text_type, const string &str) { Audio_item *text = new Audio_text (text_type, str); control_track_->add_audio_item (text); diff --git a/lily/file-name-map.cc b/lily/file-name-map.cc index 96be62c9a2..b124fda9b1 100644 --- a/lily/file-name-map.cc +++ b/lily/file-name-map.cc @@ -26,10 +26,10 @@ using namespace std; map file_name_map_global; string -map_file_name (string s) +map_file_name (const string &s) { if (file_name_map_global.find (s) != file_name_map_global.end ()) - s = file_name_map_global[s]; + return file_name_map_global[s]; return s; } diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 6990afe547..892319f3b8 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -84,12 +84,6 @@ Font_metric::get_indexed_char_dimensions (size_t) const return Box (Interval (0, 0), Interval (0, 0)); } -size_t -Font_metric::name_to_index (string) const -{ - return (size_t) - 1; -} - Offset Font_metric::get_indexed_wxwy (size_t) const { @@ -145,7 +139,7 @@ Font_metric::index_to_charcode (size_t i) const } Offset -Font_metric::attachment_point (string) const +Font_metric::attachment_point (const string&) const { return Offset (0, 0); } @@ -158,7 +152,7 @@ Font_metric::sub_fonts () const Stencil Font_metric::text_stencil (Output_def *state, - string, bool) const + const string&, bool) const { (void) state; diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index b1384076b1..ec23557333 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -27,7 +27,7 @@ using namespace std; static SCM doc_hash_table; void -ly_check_name (string cxx, string scm_name) +ly_check_name (const string &cxx, const string &scm_name) { string mangle = mangle_cxx_identifier (cxx); if (mangle != scm_name) @@ -38,9 +38,9 @@ ly_check_name (string cxx, string scm_name) void ly_add_function_documentation (SCM func, - string fname, - string varlist, - string doc) + const string &fname, + const string &varlist, + const string &doc) { if (doc == "") return; @@ -70,7 +70,7 @@ map type_names; void ly_add_type_predicate (void *ptr, - string name) + const string &name) { type_names[ptr] = name; } diff --git a/lily/global-context.cc b/lily/global-context.cc index 49bfff6e19..3fa5089e80 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -202,7 +202,7 @@ Global_context::previous_moment () const } Context * -Global_context::get_default_interpreter (string /* context_id */) +Global_context::get_default_interpreter (const string &/* context_id */) { if (get_score_context ()) return get_score_context ()->get_default_interpreter (); diff --git a/lily/gregorian-ligature.cc b/lily/gregorian-ligature.cc index e6e16e4393..a0f54ed162 100644 --- a/lily/gregorian-ligature.cc +++ b/lily/gregorian-ligature.cc @@ -21,7 +21,7 @@ #include "grob.hh" -void check_prefix (string name, int mask, int prefix_set, string *str) +void check_prefix (const string &name, int mask, int prefix_set, string *str) { if (prefix_set & mask) { diff --git a/lily/grob.cc b/lily/grob.cc index 43828310a7..dee7bdaa3c 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -724,7 +724,7 @@ Grob::internal_vertical_less (Grob *g1, Grob *g2, bool pure) MESSAGES ****************************************************************/ void -Grob::programming_error (string s) const +Grob::programming_error (const string &s) const { SCM cause = self_scm (); while (Grob *g = unsmob_grob (cause)) @@ -740,7 +740,7 @@ Grob::programming_error (string s) const } void -Grob::warning (string s) const +Grob::warning (const string &s) const { SCM cause = self_scm (); while (Grob *g = unsmob_grob (cause)) diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index 806eb1512f..8c00965744 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -59,7 +59,7 @@ Includable_lexer::Includable_lexer () /** Set the new input file to NAME, remember old file. */ void -Includable_lexer::new_input (string name, Sources *sources) +Includable_lexer::new_input (const string &name, Sources *sources) { string current_dir = dir_name (main_input_name_); if (relative_includes) @@ -94,7 +94,7 @@ Includable_lexer::new_input (string name, Sources *sources) } void -Includable_lexer::new_input (string name, string data, Sources *sources) +Includable_lexer::new_input (const string &name, string data, Sources *sources) { Source_file *file = new Source_file (name, data); sources->add (file); diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh index 3bb5b58377..7f2ca8326a 100644 --- a/lily/include/all-font-metrics.hh +++ b/lily/include/all-font-metrics.hh @@ -49,18 +49,18 @@ class All_font_metrics All_font_metrics (All_font_metrics const &); public: - Index_to_charcode_map const *get_index_to_charcode_map (string filename, + Index_to_charcode_map const *get_index_to_charcode_map (const string &filename, int face_index, FT_Face face); - All_font_metrics (string search_path); + All_font_metrics (const string &search_path); ~All_font_metrics (); Pango_font *find_pango_font (PangoFontDescription const *description, Real scale); - Font_metric *find_font (string name); - Open_type_font *find_otf (string name); + Font_metric *find_font (const string &name); + Open_type_font *find_otf (const string &name); SCM font_descriptions () const; }; diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 5e5d499fbd..544dd8378d 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -114,7 +114,7 @@ public: MARKER, CUE_POINT }; - Audio_text (Audio_text::Type type, string text_string); + Audio_text (Audio_text::Type type, const string &text_string); Type type_; string text_string_; diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index b33a555c7c..5995c70e65 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -49,7 +49,7 @@ class Axis_group_interface DECLARE_SCHEME_CALLBACK (calc_pure_relevant_items, (SCM)); DECLARE_SCHEME_CALLBACK (calc_pure_relevant_spanners, (SCM)); DECLARE_SCHEME_CALLBACK (calc_pure_y_common, (SCM)); - static SCM internal_calc_pure_relevant_grobs (Grob *, string); + static SCM internal_calc_pure_relevant_grobs (Grob *, const string&); static Interval relative_group_extent (vector const &list, Grob *common, Axis); static Interval relative_maybe_bound_group_extent (vector const &list, diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh index 482f53d970..2c9cb33125 100644 --- a/lily/include/change-iterator.hh +++ b/lily/include/change-iterator.hh @@ -31,7 +31,7 @@ public: DECLARE_CLASSNAME (Change_iterator); private: - void error (string); + void error (const string&); }; #endif diff --git a/lily/include/context.hh b/lily/include/context.hh index 14c348f6e4..c779074007 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -102,7 +102,7 @@ public: void instrumented_set_property (SCM, SCM, const char *, int, const char *); void internal_set_property (SCM var_sym, SCM value); - Context *create_context (Context_def *, string, SCM); + Context *create_context (Context_def *, const string&, SCM); DECLARE_LISTENER (create_context_from_event); DECLARE_LISTENER (acknowledge_infant); DECLARE_LISTENER (remove_context); @@ -116,7 +116,7 @@ public: virtual Context *get_score_context () const; virtual Output_def *get_output_def () const; virtual Moment now_mom () const; - virtual Context *get_default_interpreter (string context_id = ""); + virtual Context *get_default_interpreter (const string &context_id = ""); bool is_alias (SCM) const; void add_alias (SCM); @@ -125,8 +125,8 @@ public: bool is_removable () const; Context *find_create_context (SCM context_name, - string id, SCM ops); - Context *create_unique_context (SCM context_name, string context_id, + const string &id, SCM ops); + Context *create_unique_context (SCM context_name, const string &context_id, SCM ops); vector path_to_acceptable_context (SCM alias) const; }; @@ -144,7 +144,7 @@ void sloppy_general_pushpop_property (Context *context, SCM context_property, SCM grob_property_path, SCM val); SCM updated_grob_properties (Context *tg, SCM sym); Context *find_context_below (Context *where, - SCM type_sym, string id); + SCM type_sym, const string &id); bool melisma_busy (Context *); Context *get_voice_to_lyrics (Context *lyrics); diff --git a/lily/include/file-name-map.hh b/lily/include/file-name-map.hh index 3e25d7e5cf..5999f75582 100644 --- a/lily/include/file-name-map.hh +++ b/lily/include/file-name-map.hh @@ -22,7 +22,7 @@ #include "std-string.hh" -string map_file_name (string s); +string map_file_name (const string &s); #endif /* FILE_NAME_MAP_HH */ diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 70a77fd685..4c11989729 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -41,14 +41,14 @@ public: // Return stencil for given string. output_state may be modified to // record the font. virtual Stencil text_stencil (Output_def *output_state, - string text, bool music) const; + const string &text, bool music) const; virtual string font_name () const; virtual size_t count () const; - virtual Offset attachment_point (string) const; + virtual Offset attachment_point (const string&) const; virtual Offset get_indexed_wxwy (size_t) const; virtual Box get_indexed_char_dimensions (size_t index) const; - virtual size_t name_to_index (string) const; + virtual size_t name_to_index (string) const=0; virtual size_t index_to_charcode (size_t) const; virtual Real design_size () const; virtual Stencil find_by_name (string) const; diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh index 079162d272..1ea2b38dc7 100644 --- a/lily/include/global-context.hh +++ b/lily/include/global-context.hh @@ -46,7 +46,7 @@ public: virtual SCM get_output (); virtual Output_def *get_output_def () const; virtual Moment now_mom () const; - virtual Context *get_default_interpreter (string context_id = ""); + virtual Context *get_default_interpreter (const string &context_id = ""); Moment previous_moment () const; protected: diff --git a/lily/include/grob.hh b/lily/include/grob.hh index bc4071eb04..a0902d6d89 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -114,8 +114,8 @@ public: void internal_set_property (SCM sym, SCM val); /* messages */ - void warning (string) const; - void programming_error (string) const; + void warning (const string&) const; + void programming_error (const string&) const; /* class hierarchy */ virtual System *get_system () const; diff --git a/lily/include/includable-lexer.hh b/lily/include/includable-lexer.hh index c9595f923b..8378404513 100644 --- a/lily/include/includable-lexer.hh +++ b/lily/include/includable-lexer.hh @@ -53,9 +53,9 @@ public: vector file_name_strings_; Source_file *get_source_file () const; - virtual void new_input (string s, Sources *); + virtual void new_input (const string &s, Sources *); - void new_input (string name, string data, Sources *); + void new_input (const string &name, string data, Sources *); char const *here_str0 () const; }; diff --git a/lily/include/input.hh b/lily/include/input.hh index 2ae9f093ee..a11f8f8c1b 100644 --- a/lily/include/input.hh +++ b/lily/include/input.hh @@ -36,12 +36,12 @@ public: char const *end () const; void set (Source_file *, char const *, char const *); - void error (string) const; - void programming_error (string) const; - void non_fatal_error (string) const; - void warning (string) const; - void message (string) const; - void debug_output (string) const; + void error (const string&) const; + void programming_error (const string&) const; + void non_fatal_error (const string&) const; + void warning (const string&) const; + void message (const string&) const; + void debug_output (const string&) const; void set_spot (Input const &); void step_forward (); void set_location (Input const &, Input const &); @@ -63,7 +63,7 @@ public: Input (); protected: string message_location () const; - string message_string (string msg) const; + string message_string (const string &msg) const; }; #include "smobs.hh" diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh index c0df658498..a273f5ac5d 100644 --- a/lily/include/lily-guile-macros.hh +++ b/lily/include/lily-guile-macros.hh @@ -129,7 +129,7 @@ inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x)); string mangle_cxx_identifier (string); -void ly_add_type_predicate (void *ptr, string name); +void ly_add_type_predicate (void *ptr, const string &name); string predicate_to_typename (void *ptr); /* @@ -159,8 +159,8 @@ string predicate_to_typename (void *ptr); #define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \ MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, ""); -void ly_add_function_documentation (SCM proc, string fname, string varlist, string doc); -void ly_check_name (string cxx, string fname); +void ly_add_function_documentation (SCM proc, const string &fname, const string &varlist, const string &doc); +void ly_check_name (const string &cxx, const string &fname); #define ADD_SCM_INIT_FUNC(name, func) \ class name ## _scm_initter \ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index f2b8f08ba1..4592b2497d 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -50,12 +50,12 @@ SCM ly_truncate_list (int k, SCM lst); extern SCM global_lily_module; -string gulp_file_to_string (string fn, bool must_exist, int size); +string gulp_file_to_string (const string &fn, bool must_exist, int size); SCM ly_string2scm (string const &s); string ly_scm2string (SCM s); string ly_symbol2string (SCM); -string robust_symbol2string (SCM, string); +string robust_symbol2string (SCM, const string&); Rational ly_scm2rational (SCM); SCM ly_rational2scm (Rational); SCM ly_offset2scm (Offset); @@ -78,7 +78,7 @@ Drul_array robust_scm2drul (SCM, Drul_array); Drul_array robust_scm2booldrul (SCM, Drul_array); Interval robust_scm2interval (SCM, Drul_array); Offset robust_scm2offset (SCM, Offset); -string robust_scm2string (SCM, string); +string robust_scm2string (SCM, const string&); Rational robust_scm2rational (SCM, Rational); vector ly_scm2floatvector (SCM); SCM ly_floatvector2scm (vector v); diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index c12fcedd5d..4bc4cbe887 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -36,10 +36,10 @@ class Lily_lexer : public Includable_lexer DECLARE_SMOBS (Lily_lexer); private: - int lookup_keyword (string); - int scan_bare_word (string); - int scan_escaped_word (string); - int scan_shorthand (string); + int lookup_keyword (const string&); + int scan_bare_word (const string&); + int scan_escaped_word (const string&); + int scan_shorthand (const string&); int scan_scm_id (SCM); int identifier_type (SCM); char escaped_char (char) const; @@ -87,12 +87,12 @@ public: void start_main_input (); - virtual void new_input (string s, Sources *); - virtual void new_input (string s, string d, Sources *); + virtual void new_input (const string &s, Sources *); + virtual void new_input (const string &s, string d, Sources *); bool top_input () { return include_stack_.size () < 2; } SCM keyword_list () const; - SCM lookup_identifier (string s); + SCM lookup_identifier (const string &s); SCM lookup_identifier_symbol (SCM s); void push_extra_token (int token_type, SCM scm = SCM_UNSPECIFIED); void push_chord_state (SCM alist); diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh index 5009e693e3..3b4c757d65 100644 --- a/lily/include/lily-parser.hh +++ b/lily/include/lily-parser.hh @@ -62,14 +62,14 @@ public: void clear (); void do_init_file (); SCM do_yyparse (); - void include_string (string ly_code); - void parse_file (string init, string name, string out_name); - void parse_string (string ly_code); - SCM parse_string_expression (string ly_code, string filename, int line); - void parser_error (string); - void parser_error (Input const &, string); + void include_string (const string &ly_code); + void parse_file (const string &init, const string &name, const string &out_name); + void parse_string (const string &ly_code); + SCM parse_string_expression (const string &ly_code, const string &filename, int line); + void parser_error (const string&); + void parser_error (Input const &, const string&); // The following is called as yyerror - static void parser_error (Input const *i, Lily_parser *parser, SCM *, string s); + static void parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s); void set_yydebug (bool); SCM make_scope () const; diff --git a/lily/include/lilypond-version.hh b/lily/include/lilypond-version.hh index 952b19b8e1..e79f01137a 100644 --- a/lily/include/lilypond-version.hh +++ b/lily/include/lilypond-version.hh @@ -25,7 +25,7 @@ struct Lilypond_version { Lilypond_version (int major, int minor, int patch); - Lilypond_version (string str); + Lilypond_version (const string &str); string to_string () const; operator int () const; diff --git a/lily/include/midi-chunk.hh b/lily/include/midi-chunk.hh index d73b6af790..c87adf6491 100644 --- a/lily/include/midi-chunk.hh +++ b/lily/include/midi-chunk.hh @@ -43,7 +43,7 @@ public: class Midi_chunk { public: - void set (string header_string, string data_string, string footer_string); + void set (const string &header_string, const string &data_string, const string &footer_string); virtual string to_string () const; virtual string data_string () const; DECLARE_CLASSNAME (Midi_chunk); diff --git a/lily/include/midi-stream.hh b/lily/include/midi-stream.hh index ee1534da07..7ea838fdd0 100644 --- a/lily/include/midi-stream.hh +++ b/lily/include/midi-stream.hh @@ -29,10 +29,10 @@ using namespace std; struct Midi_stream { - Midi_stream (string file_name_string); + Midi_stream (const string &file_name_string); ~Midi_stream (); - void write (string); + void write (const string&); void write (Midi_chunk const &); void open (); diff --git a/lily/include/misc.hh b/lily/include/misc.hh index 511fc0545f..9bba2d09e9 100644 --- a/lily/include/misc.hh +++ b/lily/include/misc.hh @@ -64,7 +64,7 @@ Real directed_round (Real f, Direction d); Offset get_point_in_y_direction (Offset orig, Real slope, Real dist, Direction dir); Real peak_around (Real epsilon, Real threshold, Real x); Real convex_amplifier (Real standard_x, Real increase_factor, Real x); -string camel_case_to_lisp_identifier (string in); +string camel_case_to_lisp_identifier (const string &in); #endif diff --git a/lily/include/modified-font-metric.hh b/lily/include/modified-font-metric.hh index 6bf2d8d6d0..40533cb3c3 100644 --- a/lily/include/modified-font-metric.hh +++ b/lily/include/modified-font-metric.hh @@ -26,13 +26,13 @@ struct Modified_font_metric : public Font_metric { public: - Stencil text_stencil (Output_def *output_state, string, bool) const; + Stencil text_stencil (Output_def *output_state, const string&, bool) const; Real get_magnification () const; static SCM make_scaled_font_metric (Font_metric *fm, Real magnification); size_t count () const; Offset get_indexed_wxwy (size_t) const; - Offset attachment_point (string) const; + Offset attachment_point (const string&) const; size_t name_to_index (string) const; size_t index_to_charcode (size_t) const; Font_metric *original_font () const; diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 532933b84b..6155dd7dc6 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -36,7 +36,7 @@ public: static Real stem_attachment_coordinate (Grob *, Axis a); static int get_balltype (Grob *); - static Offset get_stem_attachment (Font_metric *, string); + static Offset get_stem_attachment (Font_metric *, const string&); }; #endif // NOTEHEAD_HH diff --git a/lily/include/open-type-font.hh b/lily/include/open-type-font.hh index 00ca9addb9..cb55e9744b 100644 --- a/lily/include/open-type-font.hh +++ b/lily/include/open-type-font.hh @@ -48,11 +48,11 @@ public: SCM glyph_list () const; SCM get_glyph_outline (size_t signed_idx) const; Box get_glyph_outline_bbox (size_t signed_idx) const; - string get_otf_table (string tag) const; - static SCM make_otf (string); + string get_otf_table (const string &tag) const; + static SCM make_otf (const string&); string font_name () const; ~Open_type_font (); - Offset attachment_point (string) const; + Offset attachment_point (const string&) const; size_t count () const; Box get_indexed_char_dimensions (size_t) const; Box get_unscaled_indexed_char_dimensions (size_t) const; @@ -63,7 +63,7 @@ public: Real design_size () const; }; -string get_otf_table (FT_Face face, string tag); -FT_Face open_ft_face (string str, FT_Long idx); +string get_otf_table (FT_Face face, const string &tag); +FT_Face open_ft_face (const string&, FT_Long idx); #endif /* OPEN_TYPE_FONT_HH */ diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index 3f44061513..eff52c2c38 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -65,7 +65,7 @@ public: /* variables. */ - SCM c_variable (string id) const; + SCM c_variable (const string &id) const; SCM lookup_variable (SCM sym) const; void set_variable (SCM sym, SCM val); void normalize (); diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh index f57b5d5b76..ad559551d1 100644 --- a/lily/include/pango-font.hh +++ b/lily/include/pango-font.hh @@ -48,7 +48,7 @@ public: string description_string () const; SCM font_file_name () const; - void register_font_file (string, string, int); + void register_font_file (const string &filename, const string &ps_name, int face_index); size_t name_to_index (string) const; SCM get_glyph_outline (size_t signed_idx) const; @@ -59,7 +59,7 @@ public: Stencil pango_item_string_stencil (PangoGlyphItem const *) const; virtual Stencil text_stencil (Output_def *output_state, - string text, bool music) const; + const string &text, bool music) const; virtual void derived_mark () const; }; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 90500a9f6f..02bc2746a2 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -40,7 +40,7 @@ public: DECLARE_SMOBS (Paper_outputter); public: - Paper_outputter (SCM port, string format); + Paper_outputter (SCM port, const string &format); void close (); SCM dump_string (SCM); diff --git a/lily/include/relocate.hh b/lily/include/relocate.hh index 1a3e8a38d9..5fda3c73a7 100644 --- a/lily/include/relocate.hh +++ b/lily/include/relocate.hh @@ -22,11 +22,11 @@ #include "std-string.hh" -void read_relocation_dir (string dirname); -void read_relocation_file (string filename); -string expand_environment_variables (string orig); +void read_relocation_dir (const string &dirname); +void read_relocation_file (const string &filename); +string expand_environment_variables (const string &orig); -int sane_putenv (char const *key, string value, bool overwrite); +int sane_putenv (char const *key, const string &value, bool overwrite); void setup_paths (char const *argv0); extern bool relocate_binary; diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 9a0b811ed7..d5dbae9e25 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -30,7 +30,7 @@ public: DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM)); DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM)); DECLARE_GROB_INTERFACE (); - static string glyph_name (Grob *, int, string, bool, Real); + static string glyph_name (Grob *, int durlog, const string &style, bool, Real); static Real staff_position_internal (Grob *, int /* duration_log */, int /* dir */); static SCM brew_internal_stencil (Grob *, bool); diff --git a/lily/include/slur-configuration.hh b/lily/include/slur-configuration.hh index 48ec736448..5114815619 100644 --- a/lily/include/slur-configuration.hh +++ b/lily/include/slur-configuration.hh @@ -51,7 +51,7 @@ public: Real score () const { return score_; } string card () const { return score_card_; } - void add_score (Real, string); + void add_score (Real, const string&); void generate_curve (Slur_score_state const &state, Real r0, Real h_inf, vector const &); diff --git a/lily/include/slur-proto-engraver.hh b/lily/include/slur-proto-engraver.hh index 0b0861775c..e27c96a759 100644 --- a/lily/include/slur-proto-engraver.hh +++ b/lily/include/slur-proto-engraver.hh @@ -57,8 +57,8 @@ protected: void stop_translation_timestep (); void process_music (); - bool can_create_slur (string, vsize, vsize *, Stream_event *); - void create_slur (string spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken); + bool can_create_slur (const string&, vsize, vsize *, Stream_event *); + void create_slur (const string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken); bool try_to_end (Stream_event *ev); virtual void set_melisma (bool); diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index e4bdc3f638..5f3553aea0 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -48,8 +48,8 @@ class Source_file DECLARE_SMOBS (Source_file); public: - Source_file (string fn); - Source_file (string, string); + Source_file (const string &fn); + Source_file (const string&, const string&); char const *c_str () const; virtual string quote_input (char const *pos_str0) const; @@ -73,7 +73,7 @@ protected: int line_offset_; }; -vector gulp_file (string fn, int desired); +vector gulp_file (const string &fn, int desired); #endif /* SOURCE_FILE_HH */ diff --git a/lily/include/tie-configuration.hh b/lily/include/tie-configuration.hh index 32ffb45a95..9da9e45a40 100644 --- a/lily/include/tie-configuration.hh +++ b/lily/include/tie-configuration.hh @@ -46,7 +46,7 @@ public: /* computed. */ Interval attachment_x_; - void add_score (Real, string); + void add_score (Real, const string&); Tie_configuration (); void center_tie_vertically (Tie_details const &); Bezier get_transformed_bezier (Tie_details const &) const; @@ -72,8 +72,8 @@ class Ties_configuration : public vector friend class Tie_formatting_problem; public: Ties_configuration (); - void add_score (Real amount, string description); - void add_tie_score (Real amount, int i, string description); + void add_score (Real amount, const string &description); + void add_tie_score (Real amount, int i, const string &description); Real score () const; void reset_score (); string card () const; diff --git a/lily/input.cc b/lily/input.cc index bc1e79b373..a091ef9855 100644 --- a/lily/input.cc +++ b/lily/input.cc @@ -79,7 +79,7 @@ Input::set_location (Input const &i_start, Input const &i_end) [file:line:column:][warning:]message */ string -Input::message_string (string msg) const +Input::message_string (const string &msg) const { if (source_file_) return msg + "\n" + source_file_->quote_input (start_); @@ -93,7 +93,7 @@ Input::message_location () const return (source_file_) ? location_string () : ""; } void -Input::error (string s) const +Input::error (const string &s) const { ::non_fatal_error (message_string (s), message_location ()); // UGH, fix naming or usage (use non_fatal_error in most places, instead) @@ -101,31 +101,31 @@ Input::error (string s) const } void -Input::programming_error (string s) const +Input::programming_error (const string &s) const { ::programming_error (message_string (s), message_location ()); } void -Input::non_fatal_error (string s) const +Input::non_fatal_error (const string &s) const { ::non_fatal_error (message_string (s), message_location ()); } void -Input::warning (string s) const +Input::warning (const string &s) const { ::warning (message_string (s), message_location ()); } void -Input::message (string s) const +Input::message (const string &s) const { ::message (message_string (s), true, message_location ()); } void -Input::debug_output (string s) const +Input::debug_output (const string &s) const { ::debug_output (message_string (s), true, message_location ()); } diff --git a/lily/lexer.ll b/lily/lexer.ll index 50b79a8488..18b999da82 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -907,7 +907,7 @@ Lily_lexer::identifier_type (SCM sid) int -Lily_lexer::scan_escaped_word (string str) +Lily_lexer::scan_escaped_word (const string &str) { // use more SCM for this. @@ -937,7 +937,7 @@ Lily_lexer::scan_escaped_word (string str) } int -Lily_lexer::scan_shorthand (string str) +Lily_lexer::scan_shorthand (const string &str) { SCM sid = lookup_identifier (str); if (Music *m = unsmob_music (sid)) @@ -1014,7 +1014,7 @@ Lily_lexer::scan_scm_id (SCM sid) } int -Lily_lexer::scan_bare_word (string str) +Lily_lexer::scan_bare_word (const string &str) { SCM sym = ly_symbol2scm (str.c_str ()); if ((YYSTATE == notes) || (YYSTATE == chords)) { diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 5e3b1c0f69..06018c4c9c 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -75,13 +75,13 @@ ly_symbol2string (SCM s) } string -robust_symbol2string (SCM sym, string str) +robust_symbol2string (SCM sym, const string &str) { return scm_is_symbol (sym) ? ly_symbol2string (sym) : str; } string -gulp_file_to_string (string fn, bool must_exist, int size) +gulp_file_to_string (const string &fn, bool must_exist, int size) { string s = global_path.find (fn); if (s == "") @@ -554,10 +554,10 @@ ly_floatvector2scm (vector v) } string -robust_scm2string (SCM k, string s) +robust_scm2string (SCM k, const string &s) { if (scm_is_string (k)) - s = ly_scm2string (k); + return ly_scm2string (k); return s; } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index c196808a2f..c72ff8fc12 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -178,7 +178,7 @@ Lily_lexer::set_current_scope () } int -Lily_lexer::lookup_keyword (string s) +Lily_lexer::lookup_keyword (const string &s) { return keytable_->lookup (s.c_str ()); } @@ -217,7 +217,7 @@ Lily_lexer::lookup_identifier_symbol (SCM sym) } SCM -Lily_lexer::lookup_identifier (string name) +Lily_lexer::lookup_identifier (const string &name) { return lookup_identifier_symbol (ly_symbol2scm (name.c_str ())); } @@ -236,13 +236,13 @@ Lily_lexer::start_main_input () } void -Lily_lexer::new_input (string str, string d, Sources *ss) +Lily_lexer::new_input (const string &str, string d, Sources *ss) { Includable_lexer::new_input (str, d, ss); } void -Lily_lexer::new_input (string str, Sources *ss) +Lily_lexer::new_input (const string &str, Sources *ss) { if (is_main_input_ && be_safe_global) { diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 1b78abaed0..cd7819e9c8 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -97,7 +97,7 @@ Lily_parser::print_smob (SCM s, SCM port, scm_print_state *) /* Process one .ly file, or book. */ void -Lily_parser::parse_file (string init, string name, string out_name) +Lily_parser::parse_file (const string &init, const string &name, const string &out_name) { lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ()); output_basename_ = out_name; @@ -139,7 +139,7 @@ Lily_parser::parse_file (string init, string name, string out_name) } void -Lily_parser::parse_string (string ly_code) +Lily_parser::parse_string (const string &ly_code) { lexer_->main_input_name_ = ""; lexer_->new_input (lexer_->main_input_name_, ly_code, sources_); @@ -155,7 +155,7 @@ Lily_parser::parse_string (string ly_code) } SCM -Lily_parser::parse_string_expression (string ly_code, string filename, +Lily_parser::parse_string_expression (const string &ly_code, const string &filename, int line) { lexer_->main_input_name_ = filename; @@ -178,7 +178,7 @@ Lily_parser::parse_string_expression (string ly_code, string filename, } void -Lily_parser::include_string (string ly_code) +Lily_parser::include_string (const string &ly_code) { lexer_->new_input ("", ly_code, sources_); } @@ -202,14 +202,14 @@ Lily_parser::here_str0 () const } void -Lily_parser::parser_error (string s) +Lily_parser::parser_error (const string &s) { lexer_->here_input ().error (_ (s.c_str ())); error_level_ = 1; } void -Lily_parser::parser_error (Input const &i, string s) +Lily_parser::parser_error (Input const &i, const string &s) { i.error (s); error_level_ = 1; diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc index 28bb08d761..9c6d2130a3 100644 --- a/lily/lilypond-version.cc +++ b/lily/lilypond-version.cc @@ -30,7 +30,7 @@ Lilypond_version::Lilypond_version (int major, int minor, int patch) patch_ = patch; } -Lilypond_version::Lilypond_version (string str) +Lilypond_version::Lilypond_version (const string &str) { major_ = 0; minor_ = 0; diff --git a/lily/main.cc b/lily/main.cc index 18adbb2cb7..5ac75067a0 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -334,7 +334,7 @@ warranty () } static void -prepend_scheme_list (string dir, string scmlist) +prepend_scheme_list (const string &dir, const string &scmlist) /* * Inserts an item at the front of a Scheme list, e.g. %load-path * Parameters: @@ -563,7 +563,7 @@ setup_localisation () } static void -add_output_format (string format) +add_output_format (const string &format) /* * Capture information internally from command-line options * re output format. diff --git a/lily/midi-chunk.cc b/lily/midi-chunk.cc index 699ec7e898..f98c76373e 100644 --- a/lily/midi-chunk.cc +++ b/lily/midi-chunk.cc @@ -181,7 +181,7 @@ Midi_chunk::~Midi_chunk () } void -Midi_chunk::set (string header_string, string data_string, string footer_string) +Midi_chunk::set (const string &header_string, const string &data_string, const string &footer_string) { data_string_ = data_string; footer_string_ = footer_string; diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 2d9429c767..289bb1494a 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -30,7 +30,7 @@ using namespace std; #include "string-convert.hh" #include "warn.hh" -Midi_stream::Midi_stream (string file_name) +Midi_stream::Midi_stream (const string &file_name) { file_name_string_ = file_name; out_file_ = fopen (file_name.c_str (), "wb"); @@ -44,7 +44,7 @@ Midi_stream::~Midi_stream () } void -Midi_stream::write (string str) +Midi_stream::write (const string &str) { size_t sz = sizeof (Byte); size_t n = str.length (); diff --git a/lily/misc.cc b/lily/misc.cc index f90d641a60..58d0a6e9d3 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -78,7 +78,7 @@ convex_amplifier (Real standard_x, Real increase_factor, Real x) } string -camel_case_to_lisp_identifier (string in) +camel_case_to_lisp_identifier (const string &in) { vector out; @@ -113,4 +113,4 @@ get_point_in_y_direction (Offset orig, Real slope, Real dist, Direction dir) complex res = orig_c + to_move; return Offset (real (res), imag (res)); -} \ No newline at end of file +} diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 7a54948fed..1657cf5a9e 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -74,7 +74,7 @@ Modified_font_metric::count () const } Offset -Modified_font_metric::attachment_point (string s) const +Modified_font_metric::attachment_point (const string &s) const { Offset o = orig_->attachment_point (s); return o * magnification_; @@ -87,7 +87,7 @@ Modified_font_metric::get_indexed_wxwy (vsize k) const return o * magnification_; } -vsize +size_t Modified_font_metric::name_to_index (string s) const { return orig_->name_to_index (s); @@ -106,7 +106,7 @@ Modified_font_metric::derived_mark () const Stencil Modified_font_metric::text_stencil (Output_def *state, - string text, bool feta) const + const string &text, bool feta) const { Box b; if (Pango_font *pf = dynamic_cast (orig_)) diff --git a/lily/note-head.cc b/lily/note-head.cc index 287b10dc04..4bf8168eb1 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -162,7 +162,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a) } Offset -Note_head::get_stem_attachment (Font_metric *fm, string key) +Note_head::get_stem_attachment (Font_metric *fm, const string &key) { Offset att; diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 680dfe9234..df6a744d0e 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -59,7 +59,7 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length) } string -Open_type_font::get_otf_table (string tag) const +Open_type_font::get_otf_table (const string &tag) const { return ::get_otf_table (face_, tag); } @@ -91,7 +91,7 @@ Open_type_font::~Open_type_font () UGH fix naming */ string -get_otf_table (FT_Face face, string tag) +get_otf_table (FT_Face face, const string &tag) { FT_ULong len; FT_Byte *tab = load_table (tag.c_str (), face, &len); @@ -102,7 +102,7 @@ get_otf_table (FT_Face face, string tag) } FT_Face -open_ft_face (string str, FT_Long idx) +open_ft_face (const string &str, FT_Long idx) { FT_Face face; FT_Error error_code = FT_New_Face (freetype2_library, str.c_str (), idx, &face); @@ -117,7 +117,7 @@ open_ft_face (string str, FT_Long idx) } SCM -Open_type_font::make_otf (string str) +Open_type_font::make_otf (const string &str) { FT_Face face = open_ft_face (str, 0 /* index */); Open_type_font *otf = new Open_type_font (face); @@ -151,7 +151,7 @@ Open_type_font::derived_mark () const } Offset -Open_type_font::attachment_point (string glyph_name) const +Open_type_font::attachment_point (const string &glyph_name) const { SCM sym = ly_symbol2scm (glyph_name.c_str ()); SCM entry = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F); diff --git a/lily/output-def.cc b/lily/output-def.cc index e425dbf4f9..addb0ef1ef 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -129,7 +129,7 @@ Output_def::lookup_variable (SCM sym) const } SCM -Output_def::c_variable (string s) const +Output_def::c_variable (const string &s) const { return lookup_variable (ly_symbol2scm (s.c_str ())); } diff --git a/lily/pango-font.cc b/lily/pango-font.cc index e4a07a9fd5..ee986fc94d 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -81,8 +81,8 @@ Pango_font::~Pango_font () } void -Pango_font::register_font_file (string filename, - string ps_name, +Pango_font::register_font_file (const string &filename, + const string &ps_name, int face_index) { scm_hash_set_x (physical_font_tab_, @@ -383,7 +383,7 @@ extern bool music_strings_to_paths; Stencil Pango_font::text_stencil (Output_def * /* state */, - string str, bool music_string) const + const string &str, bool music_string) const { /* The text assigned to a PangoLayout is automatically divided diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 06b490472c..34110554dc 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -40,7 +40,7 @@ using namespace std; #include "ly-smobs.icc" -Paper_outputter::Paper_outputter (SCM port, string format) +Paper_outputter::Paper_outputter (SCM port, const string &format) { file_ = port; output_module_ = SCM_EOL; diff --git a/lily/parser.yy b/lily/parser.yy index a1e1a9f080..9752da58ed 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -157,7 +157,7 @@ using namespace std; #include "warn.hh" void -Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, string s) +Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s) { parser->parser_error (*i, s); } diff --git a/lily/relocate.cc b/lily/relocate.cc index 7408106d8b..3a13f03701 100644 --- a/lily/relocate.cc +++ b/lily/relocate.cc @@ -42,7 +42,7 @@ #define FRAMEWORKDIR ".." int -sane_putenv (char const *key, string value, bool overwrite) +sane_putenv (char const *key, const string &value, bool overwrite) { if (overwrite || !getenv (key)) { @@ -64,7 +64,7 @@ sane_putenv (char const *key, string value, bool overwrite) } static int -set_env_file (char const *key, string value, bool overwrite = false) +set_env_file (char const *key, const string &value, bool overwrite = false) { if (is_file (value)) return sane_putenv (key, value, overwrite); @@ -75,7 +75,7 @@ set_env_file (char const *key, string value, bool overwrite = false) } static int -set_env_dir (char const *key, string value) +set_env_dir (char const *key, const string &value) { if (is_dir (value)) return sane_putenv (key, value, false); @@ -108,7 +108,7 @@ prepend_env_path (char const *key, string value) #endif static void -prefix_relocation (string prefix) +prefix_relocation (const string &prefix) { string bindir = prefix + "/bin"; string datadir = prefix + "/share"; @@ -141,7 +141,7 @@ prefix_relocation (string prefix) */ static void -framework_relocation (string prefix) +framework_relocation (const string &prefix) { debug_output (_f ("Relocation: framework_prefix=%s", prefix)); @@ -257,7 +257,7 @@ setup_paths (char const *argv0_ptr) } string -expand_environment_variables (string orig) +expand_environment_variables (const string &orig) { char const *start_ptr = orig.c_str (); char const *ptr = orig.c_str (); @@ -340,7 +340,7 @@ read_line (FILE *f) } void -read_relocation_file (string filename) +read_relocation_file (const string &filename) { debug_output (_f ("Relocation file: %s", filename.c_str ()) + "\n"); char const *cname = filename.c_str (); @@ -383,7 +383,7 @@ read_relocation_file (string filename) } void -read_relocation_dir (string dirname) +read_relocation_dir (const string &dirname) { if (DIR *dir = opendir (dirname.c_str ())) while (struct dirent *ent = readdir (dir)) diff --git a/lily/rest.cc b/lily/rest.cc index bf6f43758b..c4c5de1e73 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -159,7 +159,7 @@ Rest::calc_cross_staff (SCM smob) make this function easily usable in C++ */ string -Rest::glyph_name (Grob *me, int durlog, string style, bool try_ledgers, +Rest::glyph_name (Grob *me, int durlog, const string &style, bool try_ledgers, Real offset) { bool is_ledgered = false; diff --git a/lily/slur-configuration.cc b/lily/slur-configuration.cc index b144b2656f..332995ac99 100644 --- a/lily/slur-configuration.cc +++ b/lily/slur-configuration.cc @@ -187,7 +187,7 @@ Slur_configuration::Slur_configuration () }; void -Slur_configuration::add_score (Real s, string desc) +Slur_configuration::add_score (Real s, const string &desc) { if (s < 0) { diff --git a/lily/slur-proto-engraver.cc b/lily/slur-proto-engraver.cc index fbc5f00b84..f2e3456913 100644 --- a/lily/slur-proto-engraver.cc +++ b/lily/slur-proto-engraver.cc @@ -123,7 +123,7 @@ Slur_proto_engraver::finalize () } void -Slur_proto_engraver::create_slur (string spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken) +Slur_proto_engraver::create_slur (const string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken) { Grob *ccc = unsmob_grob (get_property ("currentCommandColumn")); SCM cause = ev_cause ? ev_cause->self_scm () : g_cause->self_scm (); @@ -149,7 +149,7 @@ Slur_proto_engraver::create_slur (string spanner_id, Stream_event *ev_cause, Gro } bool -Slur_proto_engraver::can_create_slur (string id, vsize old_slurs, vsize *event_idx, Stream_event *ev) +Slur_proto_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_idx, Stream_event *ev) { for (vsize j = slurs_.size (); j--;) { diff --git a/lily/source-file.cc b/lily/source-file.cc index 6ecedc9854..26426ae8af 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -55,7 +55,7 @@ Source_file::load_stdin () return contents of FILENAME. *Not 0-terminated!* */ vector -gulp_file (string filename, int desired_size) +gulp_file (const string &filename, int desired_size) { /* "b" must ensure to open literally, avoiding text (CR/LF) conversions. */ @@ -106,7 +106,7 @@ Source_file::init () smobify_self (); } -Source_file::Source_file (string filename, string data) +Source_file::Source_file (const string &filename, const string &data) { init (); @@ -124,7 +124,7 @@ Source_file::Source_file (string filename, string data) newline_locations_.push_back (&characters_[0] + i); } -Source_file::Source_file (string filename_string) +Source_file::Source_file (const string &filename_string) { init (); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 31f3af6176..c06ad9b721 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -46,12 +46,12 @@ protected: private: string new_instrument_string (); - void set_instrument_name (string voice); - void set_instrument (int channel, string voice); - int get_channel (string instrument); - Audio_staff *get_audio_staff (string voice); - Audio_staff *new_audio_staff (string voice); - Audio_dynamic *get_dynamic (string voice); + void set_instrument_name (const string &voice); + void set_instrument (int channel, const string &voice); + int get_channel (const string &instrument); + Audio_staff *get_audio_staff (const string &voice); + Audio_staff *new_audio_staff (const string &voice); + Audio_dynamic *get_dynamic (const string &voice); string instrument_string_; int channel_; @@ -111,7 +111,7 @@ Staff_performer::initialize () } Audio_staff * -Staff_performer::new_audio_staff (string voice) +Staff_performer::new_audio_staff (const string &voice) { Audio_staff *audio_staff = new Audio_staff; audio_staff->merge_unisons_ @@ -132,7 +132,7 @@ Staff_performer::new_audio_staff (string voice) } Audio_staff * -Staff_performer::get_audio_staff (string voice) +Staff_performer::get_audio_staff (const string &voice) { SCM channel_mapping = get_property ("midiChannelMapping"); if (channel_mapping != ly_symbol2scm ("instrument") @@ -152,7 +152,7 @@ Staff_performer::get_audio_staff (string voice) } Audio_dynamic * -Staff_performer::get_dynamic (string voice) +Staff_performer::get_dynamic (const string &voice) { map::const_iterator i = dynamic_map_.find (voice); if (i != dynamic_map_.end ()) @@ -166,7 +166,7 @@ Staff_performer::process_music () } void -Staff_performer::set_instrument (int channel, string voice) +Staff_performer::set_instrument (int channel, const string &voice) { instrument_ = new Audio_instrument (instrument_string_); instrument_->channel_ = channel; @@ -179,7 +179,7 @@ Staff_performer::set_instrument (int channel, string voice) } void -Staff_performer::set_instrument_name (string voice) +Staff_performer::set_instrument_name (const string &voice) { instrument_name_ = new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_string_); @@ -242,7 +242,7 @@ Staff_performer::new_instrument_string () } int -Staff_performer::get_channel (string instrument) +Staff_performer::get_channel (const string &instrument) { SCM channel_mapping = get_property ("midiChannelMapping"); map &channel_map diff --git a/lily/tie-configuration.cc b/lily/tie-configuration.cc index 79992fb808..19bcbd822c 100644 --- a/lily/tie-configuration.cc +++ b/lily/tie-configuration.cc @@ -102,7 +102,7 @@ Tie_configuration::distance (Tie_configuration const &a, } void -Tie_configuration::add_score (Real s, string desc) +Tie_configuration::add_score (Real s, const string &desc) { assert (!scored_); score_ += s; @@ -136,7 +136,7 @@ Ties_configuration::reset_score () } void -Ties_configuration::add_tie_score (Real s, int i, string desc) +Ties_configuration::add_tie_score (Real s, int i, const string &desc) { assert (!scored_); score_ += s; @@ -150,7 +150,7 @@ Ties_configuration::add_tie_score (Real s, int i, string desc) } void -Ties_configuration::add_score (Real s, string desc) +Ties_configuration::add_score (Real s, const string &desc) { assert (!scored_); score_ += s; diff --git a/lily/ttf.cc b/lily/ttf.cc index be7cfe543c..eaeb67adfb 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -467,7 +467,7 @@ print_trailer (void *out, } static void -create_type42_font (void *out, string name, int idx) +create_type42_font (void *out, const string &name, int idx) { FT_Face face; -- 2.39.2