OSDN Git Service

[Refactor] #3453 spoiler_underline() の引数をconcptr からstring_view に変えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Wed, 12 Jul 2023 10:16:47 +0000 (19:16 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sat, 15 Jul 2023 11:06:46 +0000 (20:06 +0900)
src/wizard/fixed-artifacts-spoiler.cpp
src/wizard/spoiler-util.cpp
src/wizard/spoiler-util.h

index bfa6c52..96b96c4 100644 (file)
@@ -124,7 +124,9 @@ SpoilerOutputResultType spoil_fixed_artifact()
         return SpoilerOutputResultType::FILE_OPEN_FAILED;
     }
 
-    spoiler_underline(std::string("Artifact Spoilers for Hengband Version ").append(get_version()).data());
+    std::stringstream ss;
+    ss << "Artifact Spoilers for Hengband Version " << get_version();
+    spoiler_underline(ss.str());
     for (const auto &[tval_list, name] : group_artifact_list) {
         spoiler_blanklines(2);
         spoiler_underline(name);
index 0cf6f1c..0a0afa6 100644 (file)
@@ -56,10 +56,10 @@ void spoiler_blanklines(int n)
  * Write a line to the spoiler file and then "underline" it with hypens
  * @param str 出力したい文字列
  */
-void spoiler_underline(concptr str)
+void spoiler_underline(std::string_view str)
 {
-    fprintf(spoiler_file, "%s\n", str);
-    spoiler_out_n_chars(strlen(str), '-');
+    fprintf(spoiler_file, "%s\n", str.data());
+    spoiler_out_n_chars(str.length(), '-');
     fprintf(spoiler_file, "\n");
 }
 
index db55cc0..b9f97d5 100644 (file)
@@ -55,5 +55,5 @@ extern FILE *spoiler_file;
 struct flag_desc;
 std::vector<std::string> extract_spoiler_flags(const TrFlags &art_flags, const std::vector<flag_desc> &definitions);
 void spoiler_blanklines(int n);
-void spoiler_underline(concptr str);
+void spoiler_underline(std::string_view str);
 void spoil_out(std::string_view sv, bool flush_buffer = false);