Project

General

Profile

Bug #4816

osmo-bts has rate_ctr_desc definitions in header file

Added by laforge 4 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Target version:
-
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

Revision 218b3753 (diff)
Added by fixeria 4 months ago

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

History

#1 Updated by fixeria 4 months ago

  • Status changed from New to In Progress
  • Assignee changed from sysmocom to fixeria

Given that I am currently working on osmo-bts-trx, I can quickly fix this.

#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

#3 Updated by fixeria 4 months ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)