Browse Source

apply clang-tidy fixes

master
Eyck Jentzsch 1 month ago
parent
commit
5a6cacc698
2 changed files with 6 additions and 8 deletions
  1. +3
    -1
      incl/util/strprintf.h
  2. +3
    -7
      src/ordered_semaphore.cpp

+ 3
- 1
incl/util/strprintf.h View File

@@ -17,6 +17,8 @@
#define _CRT_NO_VA_START_VALIDATION
#endif

namespace util {

inline std::string strprintf(const std::string& format, ...)
{
va_list args;
@@ -30,5 +32,5 @@ inline std::string strprintf(const std::string& format, ...)
return &vec[0];
}

}
#endif /* SCC_INCL_UTIL_STRPRINTF_H_ */

+ 3
- 7
src/ordered_semaphore.cpp View File

@@ -18,6 +18,7 @@
#include "sysc/kernel/sc_wait.h"
#include "scc/report.h"
#include <scc/ordered_semaphore.h>
#include <util/strprintf.h>

namespace scc {

@@ -49,13 +50,8 @@ void ordered_semaphore::set_capacity(unsigned c) {
}

void ordered_semaphore::report_error(const char* id, const char* add_msg) const {
char msg[BUFSIZ];
if(add_msg != nullptr) {
std::sprintf(msg, "%s: semaphore '%s'", add_msg, name());
} else {
std::sprintf(msg, "semaphore '%s'", name());
}
SC_REPORT_ERROR(id, msg);
auto msg = add_msg? util::strprintf("semaphore '%s'", name()):util::strprintf("%s: semaphore '%s'", add_msg, name());
SC_REPORT_ERROR(id, msg.c_str());
}

// constructors


Loading…
Cancel
Save