diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-10-19 22:00:59 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-12-15 21:56:25 -0500 |
commit | de75275fe54c5536c8238f0f3f88bb7ac2222942 (patch) | |
tree | 521af24ffa46304fd972b179d7af347329c1ddff /gdbsupport | |
parent | f8631e5e04dbef678323e9be6b7329f39049d2c4 (diff) | |
download | gdb-de75275fe54c5536c8238f0f3f88bb7ac2222942.zip gdb-de75275fe54c5536c8238f0f3f88bb7ac2222942.tar.gz gdb-de75275fe54c5536c8238f0f3f88bb7ac2222942.tar.bz2 |
gdbsupport: change xml_escape_text_append's parameter from pointer to reference
The passed in string can't be nullptr, it makes more sense to pass in a
reference.
Change-Id: Idc8bd38abe1d6d9b44aa227d7856956848c233b3
Diffstat (limited to 'gdbsupport')
-rw-r--r-- | gdbsupport/xml-utils.cc | 16 | ||||
-rw-r--r-- | gdbsupport/xml-utils.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/gdbsupport/xml-utils.cc b/gdbsupport/xml-utils.cc index ec5e943..e47e23c 100644 --- a/gdbsupport/xml-utils.cc +++ b/gdbsupport/xml-utils.cc @@ -27,7 +27,7 @@ xml_escape_text (const char *text) { std::string result; - xml_escape_text_append (&result, text); + xml_escape_text_append (result, text); return result; } @@ -35,29 +35,29 @@ xml_escape_text (const char *text) /* See xml-utils.h. */ void -xml_escape_text_append (std::string *result, const char *text) +xml_escape_text_append (std::string &result, const char *text) { /* Expand the result. */ for (int i = 0; text[i] != '\0'; i++) switch (text[i]) { case '\'': - *result += "'"; + result += "'"; break; case '\"': - *result += """; + result += """; break; case '&': - *result += "&"; + result += "&"; break; case '<': - *result += "<"; + result += "<"; break; case '>': - *result += ">"; + result += ">"; break; default: - *result += text[i]; + result += text[i]; break; } } diff --git a/gdbsupport/xml-utils.h b/gdbsupport/xml-utils.h index 4df2f8a..695263c 100644 --- a/gdbsupport/xml-utils.h +++ b/gdbsupport/xml-utils.h @@ -28,6 +28,6 @@ extern std::string xml_escape_text (const char *text); /* Append TEXT to RESULT, with special characters replaced by entity references. */ -extern void xml_escape_text_append (std::string *result, const char *text); +extern void xml_escape_text_append (std::string &result, const char *text); #endif /* COMMON_XML_UTILS_H */ |