convert 'Stats stats; memset(&stats, 0, sizeof(Stats));' to 'Stats stats = {};'

Not only is it more concise, but it's also just a tad more correct:
since it really should have been 'sizeof(stats)' not 'sizeof(Stats)'.

Test: builds, atest
Bug: 146787904
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6cf0295878c7b34cedfe3ae44ff7410ef419f8b9
This commit is contained in:
Maciej Żenczykowski
2019-12-30 07:54:22 -08:00
parent 3a4cc11de3
commit 4421b2b9c2

View File

@@ -150,8 +150,7 @@ static int parseUidStats(const uint32_t uid, Stats* stats) {
}
static jlong getTotalStat(JNIEnv* env, jclass clazz, jint type, jboolean useBpfStats) {
Stats stats;
memset(&stats, 0, sizeof(Stats));
Stats stats = {};
if (useBpfStats) {
if (bpfGetIfaceStats(NULL, &stats) == 0) {
@@ -175,8 +174,7 @@ static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type,
return UNKNOWN;
}
Stats stats;
memset(&stats, 0, sizeof(Stats));
Stats stats = {};
if (useBpfStats) {
if (bpfGetIfaceStats(iface8.c_str(), &stats) == 0) {
@@ -194,8 +192,7 @@ static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type,
}
static jlong getUidStat(JNIEnv* env, jclass clazz, jint uid, jint type, jboolean useBpfStats) {
Stats stats;
memset(&stats, 0, sizeof(Stats));
Stats stats = {};
if (useBpfStats) {
if (bpfGetUidStats(uid, &stats) == 0) {