Project

General

Profile

Bug #97

Rewrite the humanize function

Added by Sylvain Laperche almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
04/04/2012
Due date:
% Done:

0%

Estimated time:

Description

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.


Files

humanize.patch (3.95 KB) humanize.patch Sylvain Laperche, 04/04/2012 10:53 AM

History

#1

Updated by Robin Hahling almost 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 cvrt into util.c as well as it does not make sens to have two functions that do conversion into two different files.

Also available in: Atom PDF