Skip to content

Commit

Permalink
fix unused result warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Jan 13, 2024
1 parent 85b407a commit 11c46d2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "4.27"
#define NCHAT_VERSION "4.28"
2 changes: 2 additions & 0 deletions lib/ncutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ add_library(ncutil SHARED
src/status.h
src/strutil.cpp
src/strutil.h
src/sysutil.cpp
src/sysutil.h
src/timeutil.cpp
src/timeutil.h
)
Expand Down
5 changes: 3 additions & 2 deletions lib/ncutil/src/apputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <sys/resource.h>

#include "log.h"
#include "sysutil.h"
#include "version.h"

bool AppUtil::m_DeveloperMode = false;
Expand Down Expand Up @@ -103,8 +104,8 @@ void AppUtil::SignalHandler(int p_Signal)
Log::Callstack(callstack, size, logMsg);

// non-signal safe code section
system("reset");
write(STDERR_FILENO, logMsg, strlen(logMsg));
UNUSED(system("reset"));
UNUSED(write(STDERR_FILENO, logMsg, strlen(logMsg)));
backtrace_symbols_fd(callstack, size, STDERR_FILENO);

signal(p_Signal, SIG_DFL);
Expand Down
4 changes: 3 additions & 1 deletion lib/ncutil/src/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <sys/time.h>

#include "sysutil.h"

std::string Log::m_Path;
int Log::m_VerboseLevel = 0;
std::mutex Log::m_Mutex;
Expand Down Expand Up @@ -105,7 +107,7 @@ void Log::Callstack(void* const* p_Callstack, int p_Size, const char* p_LogMsg)
{
if (m_LogFd != -1)
{
write(m_LogFd, p_LogMsg, strlen(p_LogMsg));
UNUSED(write(m_LogFd, p_LogMsg, strlen(p_LogMsg)));
backtrace_symbols_fd(p_Callstack, p_Size, m_LogFd);
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/ncutil/src/sysutil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// sysutil.cpp
//
// Copyright (c) 2024 Kristofer Berggren
// All rights reserved.
//
// nchat is distributed under the MIT license, see LICENSE for details.

#include "sysutil.h"

20 changes: 20 additions & 0 deletions lib/ncutil/src/sysutil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// sysutil.h
//
// Copyright (c) 2024 Kristofer Berggren
// All rights reserved.
//
// nchat is distributed under the MIT license, see LICENSE for details.

#pragma once

#define UNUSED(x) SysUtil::Unused(x)

class SysUtil
{
public:
template<typename T>
static inline void Unused(const T& p_Arg)
{
(void)p_Arg;
}
};
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "January 2024" "nchat v4.27" "User Commands"
.TH NCHAT "1" "January 2024" "nchat v4.28" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down

0 comments on commit 11c46d2

Please sign in to comment.