mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-17 11:01:14 -03:00
Use const_strlen in a few different places
This may slightly improve performance by allowing the compiler greater visibility into what is happing on top of not executing at runtime in some hot paths, but more importantly, it gets rid of magic constants in a few different places.
This commit is contained in:
@@ -425,9 +425,9 @@ static char *get_interpreter(const char *command, char *buffer, size_t buff_size
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if (std::strncmp(buffer, "#! /", 4) == 0) {
|
||||
if (std::strncmp(buffer, "#! /", const_strlen("#! /")) == 0) {
|
||||
return buffer + 3;
|
||||
} else if (std::strncmp(buffer, "#!/", 3) == 0) {
|
||||
} else if (std::strncmp(buffer, "#!/", const_strlen("#!/")) == 0) {
|
||||
return buffer + 2;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user