Skip to content

Commit

Permalink
char -> const char&
Browse files Browse the repository at this point in the history
  • Loading branch information
Slackadays committed Jan 2, 2025
1 parent 09e7616 commit b19eb7c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/arch-riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ struct Extn {
// This function returns true if the first extension name should precede
// the second one as per the rule.
static bool extn_name_less(std::string_view x, std::string_view y) {
auto get_single_letter_rank = [](char c) -> i64 {
auto get_single_letter_rank = [](const char& c) -> i64 {
std::string_view exts = "iemafdqlcbkjtpvnh";
size_t pos = exts.find_first_of(c);
if (pos != exts.npos)
Expand Down
2 changes: 1 addition & 1 deletion src/cmdline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static i64 parse_number(Context<E> &ctx, std::string opt,
return ret;
}

static char from_hex(char c) {
static char from_hex(const char& c) {
if ('0' <= c && c <= '9')
return c - '0';
if ('a' <= c && c <= 'f')
Expand Down
2 changes: 1 addition & 1 deletion src/filetype.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace mold {

static bool is_text_file(MappedFile *mf) {
auto istext = [](char c) {
auto istext = [](const char& c) {
return isprint(c) || c == '\n' || c == '\t';
};

Expand Down
4 changes: 2 additions & 2 deletions src/mold.h
Original file line number Diff line number Diff line change
Expand Up @@ -3096,11 +3096,11 @@ inline bool is_c_identifier(std::string_view s) {
if (s.empty())
return false;

auto is_alpha = [](char c) {
auto is_alpha = [](const char& c) {
return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
};

auto is_alnum = [&](char c) {
auto is_alnum = [&](const char& c) {
return is_alpha(c) || ('0' <= c && c <= '9');
};

Expand Down
2 changes: 1 addition & 1 deletion src/passes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ get_start_stop_name(Context<E> &ctx, Chunk<E> &chunk) {
return std::string(chunk.name);

if (ctx.arg.start_stop) {
auto isalnum = [](char c) {
auto isalnum = [](const char& c) {
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') ||
('0' <= c && c <= '9');
};
Expand Down

0 comments on commit b19eb7c

Please sign in to comment.