Code cleanup

This commit is contained in:
Pierre Pronchery 2010-03-21 17:34:54 +00:00
parent 4306e4b5ff
commit 38407e33c4

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Network Probe */ /* This file is part of DeforaOS Network Probe */
/* Probe is not free software; you can redistribute it and/or modify it under /* Probe is not free software; you can redistribute it and/or modify it under
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 * the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
@ -156,12 +156,11 @@ static int _sysinfo_loads_sysctl(struct sysinfo * info)
static int _sysinfo_ram_sysctl(struct sysinfo * info) static int _sysinfo_ram_sysctl(struct sysinfo * info)
{ {
int mib[2]; int mib[2];
size_t len;
struct uvmexp ue; struct uvmexp ue;
size_t len = sizeof(ue);
mib[0] = CTL_VM; mib[0] = CTL_VM;
mib[1] = VM_UVMEXP; mib[1] = VM_UVMEXP;
len = sizeof(ue);
if(sysctl(mib, 2, &ue, &len, NULL, 0) == -1) if(sysctl(mib, 2, &ue, &len, NULL, 0) == -1)
{ {
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
@ -298,7 +297,7 @@ static int _ifinfo_linux(struct ifinfo ** dev)
for(i = 0; fgets(buf, sizeof(buf), fp) != NULL; i++) for(i = 0; fgets(buf, sizeof(buf), fp) != NULL; i++)
{ {
len = string_length(buf); len = string_length(buf);
if(buf[len-1] != '\n') if(buf[len - 1] != '\n')
{ {
ret = -1; ret = -1;
break; break;