mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 18:15:17 +00:00
Apply clang-format.
This commit is contained in:
parent
a3bc6a4ce6
commit
e4fad17dc0
@ -772,7 +772,7 @@ void print_github(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, github_url);
|
||||
#if defined(CURLOPT_ACCEPT_ENCODING)
|
||||
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "gzip");
|
||||
#else /* defined(CURLOPT_ACCEPT_ENCODING) */
|
||||
#else /* defined(CURLOPT_ACCEPT_ENCODING) */
|
||||
curl_easy_setopt(curl, CURLOPT_ENCODING, "gzip");
|
||||
#endif /* defined(CURLOPT_ACCEPT_ENCODING) */
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent);
|
||||
|
@ -101,7 +101,7 @@ template <typename T>
|
||||
class register_data_source {
|
||||
template <typename... Args>
|
||||
static int factory(lua::state *l, const std::string &name,
|
||||
const Args &...args) {
|
||||
const Args &... args) {
|
||||
T *t = static_cast<T *>(l->newuserdata(sizeof(T)));
|
||||
l->insert(1);
|
||||
new (t) T(l, name, args...);
|
||||
@ -113,7 +113,7 @@ class register_data_source {
|
||||
|
||||
public:
|
||||
template <typename... Args>
|
||||
explicit register_data_source(const std::string &name, Args &&...args) {
|
||||
explicit register_data_source(const std::string &name, Args &&... args) {
|
||||
priv::do_register_data_source(
|
||||
name,
|
||||
std::bind(&factory<Args...>, std::placeholders::_1, name, args...));
|
||||
|
@ -167,7 +167,7 @@ void get_fs_type(const char *path, char *result) {
|
||||
return;
|
||||
#elif defined(__sun)
|
||||
assert(0); /* not used - see update_fs_stat() */
|
||||
#else /* HAVE_STRUCT_STATFS_F_FSTYPENAME */
|
||||
#else /* HAVE_STRUCT_STATFS_F_FSTYPENAME */
|
||||
|
||||
struct mntent *me;
|
||||
FILE *mtab = setmntent("/proc/mounts", "r");
|
||||
|
@ -115,7 +115,7 @@ static int do_connect_fail(mpd_Connection *connection,
|
||||
return (connect(connection->sock, serv_addr, addrlen) == SOCKET_ERROR &&
|
||||
WSAGetLastError() != WSAEWOULDBLOCK);
|
||||
}
|
||||
#else /* !WIN32 (sane operating systems) */
|
||||
#else /* !WIN32 (sane operating systems) */
|
||||
static int do_connect_fail(mpd_Connection *connection,
|
||||
const struct sockaddr *serv_addr, int addrlen) {
|
||||
int flags = fcntl(connection->sock, F_GETFL, 0);
|
||||
@ -247,7 +247,7 @@ static int mpd_connect(mpd_Connection *connection, const char *host, int port,
|
||||
connection->error = MPD_ERROR_UNKHOST;
|
||||
return -1;
|
||||
}
|
||||
#else /* HAVE_GETHOSTBYNAME_R */
|
||||
#else /* HAVE_GETHOSTBYNAME_R */
|
||||
if (!(he_res = gethostbyname(host))) {
|
||||
snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
|
||||
"host \"%s\" not found", host);
|
||||
|
@ -3079,5 +3079,5 @@ void get_top_info(void) {
|
||||
calc_cpu_each(total); /* and then the percentage for each task */
|
||||
#ifdef BUILD_IOSTATS
|
||||
calc_io_each(); /* percentage of I/O for each task */
|
||||
#endif /* BUILD_IOSTATS */
|
||||
#endif /* BUILD_IOSTATS */
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void clean_up(void *memtofree1, void *memtofree2);
|
||||
void clean_up_without_threads(void *memtofree1, void *memtofree2);
|
||||
|
||||
template <typename... Args>
|
||||
inline void gettextize_format(const char *format, Args &&...args) {
|
||||
inline void gettextize_format(const char *format, Args &&... args) {
|
||||
fprintf(stderr, _(format), args...);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ inline void gettextize_format(const char *format, Args &&...args) {
|
||||
inline void gettextize_format(const char *format) { fputs(_(format), stderr); }
|
||||
|
||||
template <typename... Args>
|
||||
void NORM_ERR(const char *format, Args &&...args) {
|
||||
void NORM_ERR(const char *format, Args &&... args) {
|
||||
fprintf(stderr, PACKAGE_NAME ": ");
|
||||
gettextize_format(format, args...);
|
||||
fputs("\n", stderr);
|
||||
@ -83,7 +83,7 @@ void NORM_ERR(const char *format, Args &&...args) {
|
||||
/* critical error */
|
||||
template <typename... Args>
|
||||
inline void CRIT_ERR(void *memtofree1, void *memtofree2, const char *format,
|
||||
Args &&...args) {
|
||||
Args &&... args) {
|
||||
NORM_ERR(format, args...);
|
||||
clean_up(memtofree1, memtofree2);
|
||||
exit(EXIT_FAILURE);
|
||||
@ -91,7 +91,7 @@ inline void CRIT_ERR(void *memtofree1, void *memtofree2, const char *format,
|
||||
|
||||
template <typename... Args>
|
||||
inline void THREAD_CRIT_ERR(void *memtofree1, void *memtofree2,
|
||||
const char *format, Args &&...args) {
|
||||
const char *format, Args &&... args) {
|
||||
NORM_ERR(format, args...);
|
||||
clean_up_without_threads(memtofree1, memtofree2);
|
||||
return;
|
||||
|
@ -312,7 +312,7 @@ class state : private std::mutex {
|
||||
// allocate a new lua userdata of appropriate size, and create a object in it
|
||||
// pushes the userdata on stack and returns the pointer
|
||||
template <typename T, typename... Args>
|
||||
T *createuserdata(Args &&...args);
|
||||
T *createuserdata(Args &&... args);
|
||||
|
||||
using std::mutex::lock;
|
||||
using std::mutex::try_lock;
|
||||
@ -365,7 +365,7 @@ class stack_sentry {
|
||||
};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T *state::createuserdata(Args &&...args) {
|
||||
T *state::createuserdata(Args &&... args) {
|
||||
stack_sentry s(*this);
|
||||
|
||||
void *t = newuserdata(sizeof(T));
|
||||
|
@ -121,7 +121,7 @@ void parse_net_stat_arg(struct text_object *obj, const char *arg,
|
||||
#ifdef BUILD_IPV6
|
||||
bool shownetmask = false;
|
||||
bool showscope = false;
|
||||
#endif /* BUILD_IPV6 */
|
||||
#endif /* BUILD_IPV6 */
|
||||
char nextarg[21]; // longest arg possible is a devname (max 20 chars)
|
||||
int i = 0;
|
||||
struct net_stat *netstat = nullptr;
|
||||
@ -169,7 +169,7 @@ void parse_net_stat_arg(struct text_object *obj, const char *arg,
|
||||
netstat = get_net_stat(nextarg, obj, free_at_crash);
|
||||
#ifdef BUILD_IPV6
|
||||
}
|
||||
#endif /* BUILD_IPV6 */
|
||||
#endif /* BUILD_IPV6 */
|
||||
i += strlen(nextarg); // skip this arg
|
||||
while (
|
||||
!((isspace(static_cast<unsigned char>(arg[i])) != 0) || arg[i] == 0)) {
|
||||
|
@ -52,7 +52,7 @@ inline int scroll_character_length(char c) {
|
||||
|
||||
return len;
|
||||
}
|
||||
#else /* BUILD_X11 */
|
||||
#else /* BUILD_X11 */
|
||||
(void)c;
|
||||
#endif /* BUILD_X11 */
|
||||
|
||||
|
@ -419,7 +419,7 @@ void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||
if (out_to_stdout.get(*state)) {
|
||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||
}
|
||||
#else /* BUILD_X11 */
|
||||
#else /* BUILD_X11 */
|
||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||
#endif /* BUILD_X11 */
|
||||
}
|
||||
@ -729,7 +729,7 @@ void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||
if (out_to_stdout.get(*state)) {
|
||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||
}
|
||||
#else /* BUILD_X11 */
|
||||
#else /* BUILD_X11 */
|
||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||
#endif /* BUILD_X11 */
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ int parse_top_args(const char *s, const char *arg, struct text_object *obj) {
|
||||
} else {
|
||||
#ifdef BUILD_IOSTATS
|
||||
NORM_ERR("Must be top, top_mem, top_time or top_io");
|
||||
#else /* BUILD_IOSTATS */
|
||||
#else /* BUILD_IOSTATS */
|
||||
NORM_ERR("Must be top, top_mem or top_time");
|
||||
#endif /* BUILD_IOSTATS */
|
||||
free_and_zero(obj->data.opaque);
|
||||
@ -629,7 +629,7 @@ int parse_top_args(const char *s, const char *arg, struct text_object *obj) {
|
||||
NORM_ERR(
|
||||
"must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize, "
|
||||
"io_read, io_write, io_perc");
|
||||
#else /* BUILD_IOSTATS */
|
||||
#else /* BUILD_IOSTATS */
|
||||
NORM_ERR("must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize");
|
||||
#endif /* BUILD_IOSTATS */
|
||||
free_and_zero(td->s);
|
||||
|
@ -42,7 +42,7 @@ template <typename Callback>
|
||||
class callback_handle;
|
||||
void run_all_callbacks();
|
||||
template <typename Callback, typename... Params>
|
||||
callback_handle<Callback> register_cb(uint32_t period, Params &&...params);
|
||||
callback_handle<Callback> register_cb(uint32_t period, Params &&... params);
|
||||
|
||||
namespace priv {
|
||||
class callback_base {
|
||||
@ -88,7 +88,7 @@ class callback_base {
|
||||
|
||||
template <typename Callback, typename... Params>
|
||||
friend callback_handle<Callback> conky::register_cb(uint32_t period,
|
||||
Params &&...params);
|
||||
Params &&... params);
|
||||
|
||||
friend void conky::run_all_callbacks();
|
||||
|
||||
@ -140,11 +140,11 @@ class callback_handle : private std::shared_ptr<Callback> {
|
||||
friend void conky::run_all_callbacks();
|
||||
template <typename Callback_, typename... Params>
|
||||
friend callback_handle<Callback_> register_cb(uint32_t period,
|
||||
Params &&...params);
|
||||
Params &&... params);
|
||||
};
|
||||
|
||||
template <typename Callback, typename... Params>
|
||||
callback_handle<Callback> register_cb(uint32_t period, Params &&...params) {
|
||||
callback_handle<Callback> register_cb(uint32_t period, Params &&... params) {
|
||||
return std::dynamic_pointer_cast<Callback>(
|
||||
priv::callback_base::do_register_cb(priv::callback_base::handle(
|
||||
new Callback(period, std::forward<Params>(params)...))));
|
||||
|
@ -5649,7 +5649,7 @@ bool isDebuggerActive();
|
||||
// raise() called from it, i.e. one stack frame below.
|
||||
#if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
|
||||
#define CATCH_TRAP() asm volatile("int $3") /* NOLINT */
|
||||
#else // Fall back to the generic way.
|
||||
#else // Fall back to the generic way.
|
||||
#include <signal.h>
|
||||
|
||||
#define CATCH_TRAP() raise(SIGTRAP)
|
||||
|
Loading…
Reference in New Issue
Block a user