mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-04 05:53:26 +00:00 
			
		
		
		
	gtphub: fix some style complaints from cppcheck
Sponsored-by: On-Waves ehi
This commit is contained in:
		@@ -477,8 +477,6 @@ void gtphub_gc(struct gtphub *hub, time_t now);
 | 
			
		||||
 | 
			
		||||
/* Return the string of the first address for this peer. */
 | 
			
		||||
const char *gtphub_peer_str(struct gtphub_peer *peer);
 | 
			
		||||
/* Same with a different static buffer. We often want to print two peers. */
 | 
			
		||||
const char *gtphub_peer_str2(struct gtphub_peer *peer);
 | 
			
		||||
 | 
			
		||||
/* Return a human readable description of tun in a static buffer. */
 | 
			
		||||
const char *gtphub_tunnel_str(struct gtphub_tunnel *tun);
 | 
			
		||||
 
 | 
			
		||||
@@ -414,9 +414,9 @@ static int imsi_to_str(uint8_t *imsi, const char **imsi_str)
 | 
			
		||||
{
 | 
			
		||||
	static char str[17];
 | 
			
		||||
	int i;
 | 
			
		||||
	char c;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < 8; i++) {
 | 
			
		||||
		char c;
 | 
			
		||||
		c = imsi_digit_to_char(imsi[i]);
 | 
			
		||||
		if (c == '?')
 | 
			
		||||
			return -1;
 | 
			
		||||
@@ -1095,12 +1095,6 @@ const char *gtphub_peer_str(struct gtphub_peer *peer)
 | 
			
		||||
	return gtphub_peer_strb(peer, buf, sizeof(buf));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *gtphub_peer_str2(struct gtphub_peer *peer)
 | 
			
		||||
{
 | 
			
		||||
	static char buf[256];
 | 
			
		||||
	return gtphub_peer_strb(peer, buf, sizeof(buf));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *gtphub_port_str(struct gtphub_peer_port *port)
 | 
			
		||||
{
 | 
			
		||||
	static char buf[256];
 | 
			
		||||
@@ -1412,7 +1406,6 @@ static int gtphub_handle_create_pdp_ctx(struct gtphub *hub,
 | 
			
		||||
					struct gtphub_peer_port *from_ctrl,
 | 
			
		||||
					struct gtphub_peer_port *to_ctrl)
 | 
			
		||||
{
 | 
			
		||||
	int rc;
 | 
			
		||||
	int plane_idx;
 | 
			
		||||
 | 
			
		||||
	/* TODO enforce a Request only from SGSN, a Response only from GGSN? */
 | 
			
		||||
@@ -1462,6 +1455,7 @@ static int gtphub_handle_create_pdp_ctx(struct gtphub *hub,
 | 
			
		||||
	unsigned int side_idx = p->side_idx;
 | 
			
		||||
 | 
			
		||||
	for (plane_idx = 0; plane_idx < 2; plane_idx++) {
 | 
			
		||||
		int rc;
 | 
			
		||||
		struct gsn_addr addr_from_ie;
 | 
			
		||||
		uint32_t tei_from_ie;
 | 
			
		||||
		int ie_idx;
 | 
			
		||||
@@ -2169,8 +2163,6 @@ static int gtphub_make_proxy(struct gtphub *hub,
 | 
			
		||||
int gtphub_start(struct gtphub *hub, struct gtphub_cfg *cfg,
 | 
			
		||||
		 uint8_t restart_counter)
 | 
			
		||||
{
 | 
			
		||||
	int rc;
 | 
			
		||||
 | 
			
		||||
	gtphub_init(hub);
 | 
			
		||||
 | 
			
		||||
	hub->restart_counter = restart_counter;
 | 
			
		||||
@@ -2188,6 +2180,7 @@ int gtphub_start(struct gtphub *hub, struct gtphub_cfg *cfg,
 | 
			
		||||
	int side_idx;
 | 
			
		||||
	int plane_idx;
 | 
			
		||||
	for_each_side_and_plane(side_idx, plane_idx) {
 | 
			
		||||
		int rc;
 | 
			
		||||
		rc = gtphub_bind_start(&hub->to_gsns[side_idx][plane_idx],
 | 
			
		||||
				       &cfg->to_gsns[side_idx][plane_idx],
 | 
			
		||||
				       (side_idx == GTPH_SIDE_SGSN)
 | 
			
		||||
 
 | 
			
		||||
@@ -82,9 +82,9 @@ static const struct log_info gtphub_log_info = {
 | 
			
		||||
 | 
			
		||||
void log_cfg(struct gtphub_cfg *cfg)
 | 
			
		||||
{
 | 
			
		||||
	struct gtphub_cfg_addr *a;
 | 
			
		||||
	int side_idx, plane_idx;
 | 
			
		||||
	for_each_side_and_plane(side_idx, plane_idx) {
 | 
			
		||||
		struct gtphub_cfg_addr *a;
 | 
			
		||||
		a = &cfg->to_gsns[side_idx][plane_idx].bind;
 | 
			
		||||
		LOGP(DGTPHUB, LOGL_NOTICE,
 | 
			
		||||
		     "to-%ss bind, %s: %s port %d\n",
 | 
			
		||||
@@ -96,7 +96,7 @@ void log_cfg(struct gtphub_cfg *cfg)
 | 
			
		||||
 | 
			
		||||
static void signal_handler(int signal)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(stdout, "signal %u received\n", signal);
 | 
			
		||||
	fprintf(stdout, "signal %d received\n", signal);
 | 
			
		||||
 | 
			
		||||
	switch (signal) {
 | 
			
		||||
	case SIGINT:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user