1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

Everywhere: Consolidate human_readable_size() implementations

Let's use the one in AK/NumberFormat.h everywhere.

It has slightly different behavior than some of the copies this
removes, but it's probably nice to have uniform human readable
size outputs across the system.
This commit is contained in:
Nico Weber 2020-08-15 14:05:46 -04:00 committed by Andreas Kling
parent 430b265cd4
commit aa97166739
5 changed files with 10 additions and 65 deletions

View file

@ -31,8 +31,9 @@
#include "ProcessFileDescriptorMapWidget.h"
#include "ProcessMemoryMapWidget.h"
#include "ProcessModel.h"
#include "ThreadStackWidget.h"
#include "ProcessUnveiledPathsWidget.h"
#include "ThreadStackWidget.h"
#include <AK/NumberFormat.h>
#include <LibCore/Timer.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Action.h>
@ -61,17 +62,6 @@
#include <stdio.h>
#include <unistd.h>
static String human_readable_size(u32 size)
{
if (size < (64 * KiB))
return String::format("%u", size);
if (size < MiB)
return String::format("%u KB", size / KiB);
if (size < GiB)
return String::format("%u MB", size / MiB);
return String::format("%u GB", size / GiB);
}
static NonnullRefPtr<GUI::Widget> build_file_systems_tab();
static NonnullRefPtr<GUI::Widget> build_pci_devices_tab();
static NonnullRefPtr<GUI::Widget> build_devices_tab();