cc_log("Hostname: %s", get_hostname());
cc_log("Working directory: %s", get_current_working_dir());
- g_config.set_limit_multiple(MIN(MAX(g_config.limit_multiple(), 0.0), 1.0));
+ g_config.set_limit_multiple(
+ std::min(std::max(g_config.limit_multiple(), 0.0), 1.0));
MTR_BEGIN("main", "guess_compiler");
guessed_compiler = guess_compiler(orig_args->argv[0]);
# define DIR_DELIM_CH '/'
# define PATH_DELIM ":"
#endif
-
-#ifndef MAX
-# define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
#include "ccache.hpp"
#include "compression.hpp"
+#include <algorithm>
#include <zstd.h>
#define DEFAULT_ZSTD_COMPRESSION_LEVEL -1
level = 1;
}
- state->compression_level = MIN(level, ZSTD_maxCLevel());
+ state->compression_level = std::min<int>(level, ZSTD_maxCLevel());
if (state->compression_level != level) {
cc_log("Using compression level %d (max libzstd level) instead of %d",
state->compression_level,
struct stat file_stat;
if (stat(path, &file_stat) != -1) {
- if (time_of_compilation > MAX(file_stat.st_mtime, file_stat.st_ctime)) {
+ if (time_of_compilation
+ > std::max(file_stat.st_mtime, file_stat.st_ctime)) {
fi.mtime = file_stat.st_mtime;
fi.ctime = file_stat.st_ctime;
} else {
char buf[READ_BUFFER_SIZE];
size_t remain = file_len;
while (remain > 0) {
- size_t n = MIN(remain, sizeof(buf));
+ size_t n = std::min(remain, sizeof(buf));
READ_BYTES(buf, n);
if (fwrite(buf, 1, n, subfile) != n) {
goto out;
char buf[READ_BUFFER_SIZE];
size_t remain = file_len;
while (remain > 0) {
- size_t n = MIN(remain, sizeof(buf));
+ size_t n = std::min(remain, sizeof(buf));
READ_BYTES(buf, n);
remain -= n;
}
}
remain = file->size;
while (remain > 0) {
- size_t n = MIN(remain, sizeof(buf));
+ size_t n = std::min(remain, sizeof(buf));
if (fread(buf, 1, n, f) != n) {
goto error;
}
counters->data[STATS_ZEROTIMESTAMP] = 0; // Don't add
stats_read(fname, counters);
- zero_timestamp = MAX(counters->data[STATS_ZEROTIMESTAMP], zero_timestamp);
+ zero_timestamp =
+ std::max(counters->data[STATS_ZEROTIMESTAMP], zero_timestamp);
if (stat(fname, &st) == 0 && st.st_mtime > *last_updated) {
*last_updated = st.st_mtime;
}
char buf[8192];
int len = vsnprintf(buf, sizeof(buf), format, aq);
if (len >= 0) {
- append_to_debug_log(buf, MIN((size_t)len, sizeof(buf) - 1));
+ append_to_debug_log(buf, std::min((size_t)len, sizeof(buf) - 1));
append_to_debug_log("\n", 1);
}
}