Bug #4816
osmo-bts has rate_ctr_desc definitions in header file
Start date:
10/18/2020
Due date:
% Done:
100%
Spec Reference:
Description
a header file should only contain declarations, not entire definitions.
The fact that we have constructs like
static const struct rate_ctr_desc bts_ctr_description[] = { [BTS_CTR_CHREQ_TOTAL] = {"chreq:total", "Received channel requests"},
in a header file means that very C file including this header file will get its own private copy of the entire definition.
The header file should only include this declaration:
extern const struct rate_ctr_desc bts_ctr_description[];
and the actual non-static definition should be in a C file.
Associated revisions
History
#2 Updated by fixeria 4 months ago
- Status changed from In Progress to Feedback
- % Done changed from 0 to 100
https://gerrit.osmocom.org/c/osmo-bsc/+/20731 bts: move rate counter / stat item definitions from *.h to *.c
bts: move rate counter / stat item definitions from *.h to *.c
A header file should only contain declarations, not entire definitions.
The fact that we have 'static const struct ...' definitions in a header
file means that very C file including this header file will get its own
private copy of the entire definition.
The header file should only include declarations, while the actual
non-static definitions should go to a *.c file. Let's fix this.
Also, take a chance to improve readability and apply more consistent
formatting (similar to 'struct hf_register_info[]' in Wireshark).
Change-Id: Ib5949879902acbe1edda577477d9d51a2cc425d1
Closes: OS#4816