mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 17:55:06 -05:00
sources: optimize SRC_ReportSource() a bit
Remove unnecessary memset() call and use the default case of the switch to report the unreachable state.
This commit is contained in:
12
sources.c
12
sources.c
@@ -1294,7 +1294,6 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now)
|
|||||||
} else {
|
} else {
|
||||||
src = sources[index];
|
src = sources[index];
|
||||||
|
|
||||||
memset(&report->ip_addr, 0, sizeof (report->ip_addr));
|
|
||||||
if (src->ip_addr)
|
if (src->ip_addr)
|
||||||
report->ip_addr = *src->ip_addr;
|
report->ip_addr = *src->ip_addr;
|
||||||
else {
|
else {
|
||||||
@@ -1304,14 +1303,6 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (src->status) {
|
switch (src->status) {
|
||||||
case SRC_UNSELECTABLE:
|
|
||||||
case SRC_BAD_STATS:
|
|
||||||
case SRC_BAD_DISTANCE:
|
|
||||||
case SRC_STALE:
|
|
||||||
case SRC_ORPHAN:
|
|
||||||
case SRC_WAITS_STATS:
|
|
||||||
report->state = RPT_UNREACH;
|
|
||||||
break;
|
|
||||||
case SRC_FALSETICKER:
|
case SRC_FALSETICKER:
|
||||||
report->state = RPT_FALSETICKER;
|
report->state = RPT_FALSETICKER;
|
||||||
break;
|
break;
|
||||||
@@ -1331,9 +1322,8 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now)
|
|||||||
case SRC_SELECTED:
|
case SRC_SELECTED:
|
||||||
report->state = RPT_SYNC;
|
report->state = RPT_SYNC;
|
||||||
break;
|
break;
|
||||||
case SRC_OK:
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
report->state = RPT_UNREACH;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user