cli : avoid std::exchange

ggml-ci
This commit is contained in:
Georgi Gerganov 2025-05-07 13:22:47 +03:00
parent eeaa1cd035
commit 0055356fbc
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -9,7 +9,6 @@
#include <cstdio>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include <cstring>
@ -1019,10 +1018,12 @@ int main(int argc, char ** argv) {
bool open(const char * ext, const char * function) {
if (is_stdout) {
if (std::exchange(used_stdout, true)) {
if (used_stdout) {
fprintf(stderr, "warning: Not appending multiple file formats to stdout\n");
return false;
}
used_stdout = true;
#ifdef _WIN32
fout = std::ofstream{"CON"};
#else
@ -1032,6 +1033,7 @@ int main(int argc, char ** argv) {
// Also assuming /dev is mounted
return true;
}
fname_out.resize(basename_length);
fname_out += ext;
fout = std::ofstream{fname_out};