[PATCH] iftop: fix compilation with GCC 10

Bjørn Mork bjorn at mork.no
Fri Jul 17 06:47:28 EDT 2020


Rosen Penev <rosenp at gmail.com> writes:
>> On Jul 17, 2020, at 3:06 AM, Felix Fietkau <nbd at nbd.name> wrote:

>>> +--- a/ui_common.h
>>> ++++ b/ui_common.h
>>> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
>>> + 
>>> + extern options_t options;
>>> + 
>>> +-sorted_list_type screen_list;
>>> +-host_pair_line totals;
>>> +-int peaksent, peakrecv, peaktotal;
>>> ++static sorted_list_type screen_list;
>>> ++static host_pair_line totals;
>>> ++static int peaksent, peakrecv, peaktotal;
>>> + extern history_type history_totals;
>>> +-hash_type* screen_hash;
>>> +-hash_type* service_hash;
>>> ++static hash_type* screen_hash;
>>> ++static hash_type* service_hash;
>>
>> Declaring these variables as static in a header file seems wrong to me.
>> Shouldn't this be declared as a global variable in one of the .c files
>> and extern here?
>
> Sure. static creates a smaller patch though.

How does that help if the result is buggy?  I assume these variables are
declared in a header because their values are actually shared.


Bjørn



More information about the openwrt-devel mailing list