Skip to content

Commit 4a512cb

Browse files
committed
cli : avoid std::exchange
ggml-ci
1 parent 76171ce commit 4a512cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/cli/cli.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <cstdio>
1010
#include <string>
1111
#include <thread>
12-
#include <utility>
1312
#include <vector>
1413
#include <cstring>
1514

@@ -1019,10 +1018,12 @@ int main(int argc, char ** argv) {
10191018

10201019
bool open(const char * ext, const char * function) {
10211020
if (is_stdout) {
1022-
if (std::exchange(used_stdout, true)) {
1021+
if (used_stdout) {
10231022
fprintf(stderr, "warning: Not appending multiple file formats to stdout\n");
10241023
return false;
10251024
}
1025+
1026+
used_stdout = true;
10261027
#ifdef _WIN32
10271028
fout = std::ofstream{"CON"};
10281029
#else
@@ -1032,6 +1033,7 @@ int main(int argc, char ** argv) {
10321033
// Also assuming /dev is mounted
10331034
return true;
10341035
}
1036+
10351037
fname_out.resize(basename_length);
10361038
fname_out += ext;
10371039
fout = std::ofstream{fname_out};

0 commit comments

Comments
 (0)