From 0aff25170bae9a070ea6537a38d8b8b9aba60c4f Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Thu, 22 Oct 2020 20:24:08 +0200 Subject: [PATCH] [linux] Remove config.h from installable headers. This fixes #2964. Signed-off-by: Vitalii Koshura --- lib/gui_rpc_client.h | 1 - lib/parse.cpp | 24 +++++++++++++++++++++++- lib/parse.h | 28 ++-------------------------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 4b96dd5885..f4cdc760c5 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -23,7 +23,6 @@ #ifdef _WIN32 #include "boinc_win.h" #endif -#include "config.h" #if !defined(_WIN32) || defined (__CYGWIN__) #include diff --git a/lib/parse.cpp b/lib/parse.cpp index c317b10c4b..eaa70f6782 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2018 University of California +// Copyright (C) 2020 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License @@ -52,6 +52,28 @@ using std::string; +unsigned long long boinc_strtoull(const char *str, char **endptr, int base) { +#if (defined (__cplusplus) && __cplusplus > 199711L) || defined(HAVE_STRTOULL) || defined(__MINGW32__) + return strtoull(str, endptr, base); +#elif defined(_WIN32) && !defined(__MINGW32__) + return _strtoui64(str, endptr, base); +#else + char buf[64]; + char *p; + unsigned long long y; + strncpy(buf, str, sizeof(buf)-1); + strip_whitespace(buf); + p = strstr(buf, "0x"); + if (!p) p = strstr(buf, "0X"); + if (p) { + sscanf(p, "%llx", &y); + } else { + sscanf(buf, "%llu", &y); + } + return y; +#endif +} + // Parse a boolean; tag is of form "foobar" // Accept either , , or 0|1 // (possibly with leading/trailing white space) diff --git a/lib/parse.h b/lib/parse.h index 94a881805f..eea53e6084 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2020 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License @@ -23,8 +23,6 @@ #include #include -#include "config.h" - #include "miofile.h" #include "error_numbers.h" #include "str_util.h" @@ -287,29 +285,7 @@ inline bool match_tag(const std::string &s, const char* tag) { return match_tag(s.c_str(), tag); } -#if defined(_WIN32) && !defined(__MINGW32__) -#define boinc_strtoull _strtoui64 -#else -#if defined(HAVE_STRTOULL) || defined(__MINGW32__) -#define boinc_strtoull strtoull -#else -inline unsigned long long boinc_strtoull(const char *s, char **, int) { - char buf[64]; - char *p; - unsigned long long y; - strncpy(buf, s, sizeof(buf)-1); - strip_whitespace(buf); - p = strstr(buf, "0x"); - if (!p) p = strstr(buf, "0X"); - if (p) { - sscanf(p, "%llx", &y); - } else { - sscanf(buf, "%llu", &y); - } - return y; -} -#endif -#endif +extern unsigned long long boinc_strtoull(const char *, char **, int); // parse an integer of the form 1234 // return true if it's there