Rewrite the humanize function
Currently, the humanize fonction humanizes the size and prints it. By this way, it has two responsabilities and it is not good for the forthcoming display architecture.
During the display task, it calls reset_color and change_color (functions that depend of output format) so this function should be in disp.c. But this solution is not satisfactory because it implies a duplication of code for each output format (the computation for the humanization doesn't depends of the output format).
My solution, provided in the attached patch, is to give only one responsability to the humanize function: humanize the size; and give the responsability of displaying in disp_at (the function which calls humanize).
Moreover, we need to move humanize into utils.c in order to avoid an ugly circular dependancy: dfc need disp module for display, but disp module need dfc to call humanize.
Updated by Robin Hahling about 8 years ago
- Status changed from New to Closed
Thanks for the patch :)
This function really needed a rewrite. I had to fix a few warnings though. I'll move
util.c as well as it does not make sens to have two functions that do conversion into two different files.