Upravy z clang-tidy

This commit is contained in:
Pavel Brychta 2023-05-20 12:47:13 +02:00
parent 9f29c8b1b1
commit 67a93dbeab
2 changed files with 16 additions and 19 deletions

View File

@ -5,9 +5,9 @@
#define MAX_LINE_LEN 50
struct TraceLine {
char _text[MAX_LINE_LEN + 1];
uint32_t _time;
uint8_t _severity;
char _text[MAX_LINE_LEN + 1] = {0};
uint32_t _time{};
uint8_t _severity{};
TraceLine(uint8_t severity, const char *str, uint16_t len)
{
@ -17,17 +17,17 @@ struct TraceLine {
_severity = severity;
}
TraceLine(void) {}
TraceLine() = default;
};
static TraceLine _lines[MAX_TRACE_LINES];
static uint16_t _lines_index = 0;
static uint16_t _lines_count = 0;
static volatile int _modified = 0;
static AsyncWebSocket *_wss = NULL; // webovy soket pro trasovani
static AsyncWebSocket *_wss = nullptr; // webovy soket pro trasovani
static Interval _tint(TRACE_CHECK_INTERVAL); // interval pro casovani stopare
static void (*message_cb)(const char *) = NULL;
static void (*message_cb)(const char *) = nullptr;
static int modulo(int a, int b)
{
@ -69,7 +69,7 @@ static void print(uint8_t severity, const char *buffer, int length)
++_modified;
}
void trace_init(void)
void trace_init()
{
}
@ -136,7 +136,7 @@ void trace_dumpJSON(String &str)
}
}
void trace_clear(void)
void trace_clear()
{
_lines_index = 0;
@ -144,7 +144,7 @@ void trace_clear(void)
_modified = 1;
}
void trace_end(void)
void trace_end()
{
trace_clear();
@ -255,7 +255,7 @@ void trace_forceupdate(void)
void trace_poll()
{
if (NULL != _wss) {
if (nullptr != _wss) {
// je definovany webovy soket
if (_modified) {
// mame nejakou zmenu

View File

@ -2,7 +2,7 @@
* @file trace.h
* @author Pavel Brychta, http://www.xpablo.cz
*
* Copyright (c) 2016-22 Pavel Brychta. All rights reserved.
* Copyright (c) 2016-23 Pavel Brychta. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _TRACE_H_
#define _TRACE_H_
#pragma once
// Definice jednotlivych typu hlaseni do trasovani
#define TRACE_ERROR 0 // chybova zprava = cervena
@ -39,7 +38,7 @@
/**
* @brief Inicializace modulu
*/
void trace_init(void);
void trace_init();
/**
* @brief Ziskani vypisu v JSON formatu
@ -51,12 +50,12 @@ void trace_dumpJSON(String &str);
/**
* @brief Vyprazdneni stopovaciho bufferu
*/
void trace_clear(void);
void trace_clear();
/**
* @brief Ukonceni prace stopare - vyprazdni buffer
*/
void trace_end(void);
void trace_end();
/**
* @brief Ulozeni zpravy s obsahem z programove pameti (PROGMEM, F, ...)
@ -120,7 +119,7 @@ void trace_dump(uint8_t severity, const __FlashStringHelper *prefix, uint8_t *ad
/**
* @brief Vynuceni odeslani obsahu bufferu (napr. pri obnovovani spojeni)
*/
void trace_forceupdate(void);
void trace_forceupdate();
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
@ -144,5 +143,3 @@ void trace_forceupdate(void);
#define TRACE_POLL(a) ((void)0)
#define TRACE_FORCEUPDATE(a) ((void)0)
#endif // DONT_USE_TRACE
#endif // _TRACE_H_