[sanitizer] Use const char* in internal_simple_strtoll

llvm-svn: 334900
This commit is contained in:
Vitaly Buka 2018-06-17 08:41:45 +00:00
parent 9786946731
commit b957f99d57
7 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ static void PrintZoneForPointer(uptr ptr, uptr zone_ptr,
bool ParseFrameDescription(const char *frame_descr,
InternalMmapVector<StackVarDescr> *vars) {
CHECK(frame_descr);
char *p;
const char *p;
// This string is created by the compiler and has the following form:
// "n alloc_1 alloc_2 ... alloc_n"
// where alloc_i looks like "offset size len ObjectName"

View File

@ -81,7 +81,7 @@ inline bool FlagHandler<const char *>::Parse(const char *value) {
template <>
inline bool FlagHandler<int>::Parse(const char *value) {
char *value_end;
const char *value_end;
*t_ = internal_simple_strtoll(value, &value_end, 10);
bool ok = *value_end == 0;
if (!ok) Printf("ERROR: Invalid value for int option: '%s'\n", value);
@ -90,7 +90,7 @@ inline bool FlagHandler<int>::Parse(const char *value) {
template <>
inline bool FlagHandler<uptr>::Parse(const char *value) {
char *value_end;
const char *value_end;
*t_ = internal_simple_strtoll(value, &value_end, 10);
bool ok = *value_end == 0;
if (!ok) Printf("ERROR: Invalid value for uptr option: '%s'\n", value);

View File

@ -215,7 +215,7 @@ char *internal_strstr(const char *haystack, const char *needle) {
return nullptr;
}
s64 internal_simple_strtoll(const char *nptr, char **endptr, int base) {
s64 internal_simple_strtoll(const char *nptr, const char **endptr, int base) {
CHECK_EQ(base, 10);
while (IsSpace(*nptr)) nptr++;
int sgn = 1;

View File

@ -49,7 +49,7 @@ uptr internal_strnlen(const char *s, uptr maxlen);
char *internal_strrchr(const char *s, int c);
char *internal_strstr(const char *haystack, const char *needle);
// Works only for base=10 and doesn't set errno.
s64 internal_simple_strtoll(const char *nptr, char **endptr, int base);
s64 internal_simple_strtoll(const char *nptr, const char **endptr, int base);
int internal_snprintf(char *buffer, uptr length, const char *format, ...);
// Return true if all bytes in [mem, mem+size) are zero.

View File

@ -236,7 +236,7 @@ uptr ThreadDescriptorSize() {
char buf[64];
uptr len = confstr(_CS_GNU_LIBC_VERSION, buf, sizeof(buf));
if (len < sizeof(buf) && internal_strncmp(buf, "glibc 2.", 8) == 0) {
char *end;
const char *end;
int minor = internal_simple_strtoll(buf + 8, &end, 10);
if (end != buf + 8 && (*end == '\0' || *end == '.' || *end == '-')) {
int patch = 0;

View File

@ -82,7 +82,7 @@ bool readValueFromFile(const char *Filename,
if (!Success)
return false;
close(Fd);
char *End = nullptr;
const char *End = nullptr;
long long Tmp = internal_simple_strtoll(Line, &End, 10);
bool Result = false;
if (Line[0] != '\0' && (*End == '\n' || *End == '\0')) {

View File

@ -57,7 +57,7 @@ static bool readValueFromFile(const char *Filename,
close(Fd);
if (!Success)
return false;
char *End = nullptr;
const char *End = nullptr;
long long Tmp = internal_simple_strtoll(Line, &End, 10);
bool Result = false;
if (Line[0] != '\0' && (*End == '\n' || *End == '\0')) {