Skip to content

Commit 78631fa

Browse files
committed
Fix compiler warnings by ensuring variable initialization
1 parent 315c9a3 commit 78631fa

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/base/tcpsocket.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
3232
{
3333
addrinfo hints;
3434
addrinfo *result;
35-
int error;
36-
const char *func;
35+
int error = 0;
36+
const char *func = nullptr;
3737

3838
memset(&hints, 0, sizeof(hints));
3939
hints.ai_family = family;
@@ -126,8 +126,8 @@ void TcpSocket::Connect(const String& node, const String& service)
126126
{
127127
addrinfo hints;
128128
addrinfo *result;
129-
int error;
130-
const char *func;
129+
int error = 0;
130+
const char *func = nullptr;
131131

132132
memset(&hints, 0, sizeof(hints));
133133
hints.ai_family = AF_UNSPEC;

lib/icinga/legacytimeperiod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St
541541
ProcessTimeRanges(timeranges, &iter, segments);
542542

543543
Dictionary::Ptr bestSegment;
544-
double bestBegin;
544+
double bestBegin = 0;
545545

546546
ObjectLock olock(segments);
547547
for (Dictionary::Ptr segment : segments) {

tools/mkclass/class_lexer.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ do { \
2626
} while (0)
2727

2828
struct lex_buf {
29-
char *buf;
30-
size_t size;
29+
char *buf = NULL;
30+
size_t size = 0;
3131
};
3232

3333
static void lb_init(lex_buf *lb)

0 commit comments

Comments
 (0)