Change in libosmocore[master]: [cosmetic] rest_octets: Follow coding style regarding {}

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 15 06:06:19 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/20651 )


Change subject: [cosmetic] rest_octets: Follow coding style regarding {}
......................................................................

[cosmetic] rest_octets: Follow coding style regarding {}

As pespin point out, the kernel coding style says:

Do not unnecessarily use braces where a single statement will do.
[...]
This does not apply if only one branch of a conditional statement is a single
statement; in the latter case use braces in both branches:

Change-Id: Ia23c4bd018db141ff0afe77fe25678a9b2a395f0
---
M src/gsm/gsm48_rest_octets.c
1 file changed, 46 insertions(+), 23 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/20651/1

diff --git a/src/gsm/gsm48_rest_octets.c b/src/gsm/gsm48_rest_octets.c
index 86f18b7..a527598 100644
--- a/src/gsm/gsm48_rest_octets.c
+++ b/src/gsm/gsm48_rest_octets.c
@@ -46,8 +46,9 @@
 	if (nch_pos) {
 		bitvec_set_bit(&bv, H);
 		bitvec_set_uint(&bv, *nch_pos, 5);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	if (is1800_net)
 		bitvec_set_bit(&bv, L);
@@ -134,8 +135,9 @@
 		/* E-UTRAN_PRIORITY: 3GPP TS 45.008*/
 		bitvec_set_bit(bv, 1);
 		bitvec_set_uint(bv, e->prio, 3);
-	} else
+	} else {
 		bitvec_set_bit(bv, 0);
+	}
 
 	/* THRESH_E-UTRAN_high */
 	bitvec_set_uint(bv, e->thresh_hi, 5);
@@ -144,15 +146,17 @@
 		/* THRESH_E-UTRAN_low: */
 		bitvec_set_bit(bv, 1);
 		bitvec_set_uint(bv, e->thresh_lo, 5);
-	} else
+	} else {
 		bitvec_set_bit(bv, 0);
+	}
 
 	if (e->qrxlm_valid) {
 		/* E-UTRAN_QRXLEVMIN: */
 		bitvec_set_bit(bv, 1);
 		bitvec_set_uint(bv, e->qrxlm, 5);
-	} else
+	} else {
 		bitvec_set_bit(bv, 0);
+	}
 
 	return true;
 }
@@ -404,8 +408,9 @@
 			if (i < uarfcn_length) {
 				cu = uarfcn_list[i];
 				st = i;
-			} else
+			} else {
 				break;
+			}
 		}
 
 	/* stop bit - end of Repeated UTRAN FDD Neighbour Cells */
@@ -508,8 +513,9 @@
 		bitvec_set_uint(bv, sp->cell_resel_off, 6);
 		bitvec_set_uint(bv, sp->temp_offs, 3);
 		bitvec_set_uint(bv, sp->penalty_time, 5);
-	} else
+	} else {
 		bitvec_set_bit(bv, L);
+	}
 }
 
 /* Append power offset to bitvec */
@@ -519,8 +525,9 @@
 	if (po->present) {
 		bitvec_set_bit(bv, H);
 		bitvec_set_uint(bv, po->power_offset, 2);
-	} else
+	} else {
 		bitvec_set_bit(bv, L);
+	}
 }
 
 /* Append GPRS indicator to bitvec */
@@ -532,8 +539,9 @@
 		bitvec_set_uint(bv, gi->ra_colour, 3);
 		/* 0 == SI13 in BCCH Norm, 1 == SI13 sent on BCCH Ext */
 		bitvec_set_bit(bv, gi->si13_position);
-	} else
+	} else {
 		bitvec_set_bit(bv, L);
+	}
 }
 
 /* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
@@ -567,8 +575,9 @@
 	if (si3->scheduling.present) {
 		bitvec_set_bit(&bv, H);
 		bitvec_set_uint(&bv, si3->scheduling.where, 3);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	/* GPRS Indicator */
 	append_gprs_ind(&bv, &si3->gprs_ind);
@@ -618,22 +627,25 @@
 		if (si4->lsa_params.present) {
 			bitvec_set_bit(&bv, H);
 			append_lsa_params(&bv, &si4->lsa_params);
-		} else
+		} else {
 			bitvec_set_bit(&bv, L);
+		}
 
 		/* Cell Identity */
 		if (1) {
 			bitvec_set_bit(&bv, H);
 			bitvec_set_uint(&bv, si4->cell_id, 16);
-		} else
+		} else {
 			bitvec_set_bit(&bv, L);
+		}
 
 		/* LSA ID Information */
 		if (0) {
 			bitvec_set_bit(&bv, H);
 			/* FIXME */
-		} else
+		} else {
 			bitvec_set_bit(&bv, L);
+		}
 	} else {
 		/* L and break indicator */
 		bitvec_set_bit(&bv, L);
@@ -671,25 +683,29 @@
 		if (in->pch_nch_info.call_priority_present) {
 			bitvec_set_bit(&bv, 1);
 			bitvec_set_uint(&bv, in->pch_nch_info.call_priority, 3);
-		} else
+		} else {
 			bitvec_set_bit(&bv, 0);
+		}
 		bitvec_set_bit(&bv, !!in->pch_nch_info.nln_status_sacch);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	if (in->vbs_vgcs_options.present) {
 		bitvec_set_bit(&bv, H);
 		bitvec_set_bit(&bv, !!in->vbs_vgcs_options.inband_notifications);
 		bitvec_set_bit(&bv, !!in->vbs_vgcs_options.inband_pagings);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	if (in->dtm_support.present) {
 		bitvec_set_bit(&bv, H);
 		bitvec_set_uint(&bv, in->dtm_support.rac, 8);
 		bitvec_set_uint(&bv, in->dtm_support.max_lapdm, 3);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	if (in->band_indicator_1900)
 		bitvec_set_bit(&bv, H);
@@ -699,8 +715,9 @@
 	if (in->gprs_ms_txpwr_max_ccch.present) {
 		bitvec_set_bit(&bv, H);
 		bitvec_set_uint(&bv, in->gprs_ms_txpwr_max_ccch.max_txpwr, 5);
-	} else
+	} else {
 		bitvec_set_bit(&bv, L);
+	}
 
 	bitvec_spare_padding(&bv, (bv.data_len * 8) - 1);
 	return bv.data_len;
@@ -730,8 +747,9 @@
 		/* We want to use a RFL number list */
 		bitvec_set_bit(bv, 1);
 		/* FIXME: RFL number list */
-	} else
+	} else {
 		bitvec_set_bit(bv, 0);
+	}
 
 	if (0) {
 		/* We want to use a MA_BITMAP */
@@ -743,8 +761,9 @@
 			/* We want to provide an ARFCN index list */
 			bitvec_set_bit(bv, 1);
 			/* FIXME */
-		} else
+		} else {
 			bitvec_set_bit(bv, 0);
+		}
 	}
 	return 0;
 }
@@ -973,15 +992,17 @@
 		sp->cell_resel_off = bitvec_get_uint(&bv, 6);
 		sp->temp_offs = bitvec_get_uint(&bv, 3);
 		sp->penalty_time = bitvec_get_uint(&bv, 5);
-	} else
+	} else {
 		sp->present = 0;
+	}
 
 	/* Optional Power Offset */
 	if (bitvec_get_bit_high(&bv) == H) {
 		po->present = 1;
 		po->power_offset = bitvec_get_uint(&bv, 2);
-	} else
+	} else {
 		po->present = 0;
+	}
 
 	/* System Information 2ter Indicator */
 	if (bitvec_get_bit_high(&bv) == H)
@@ -999,16 +1020,18 @@
 	if (bitvec_get_bit_high(&bv) == H) {
 		si3->scheduling.present = 1;
 		si3->scheduling.where = bitvec_get_uint(&bv, 3);
-	} else
+	} else {
 		si3->scheduling.present = 0;
+	}
 
 	/* GPRS Indicator */
 	if (bitvec_get_bit_high(&bv) == H) {
 		gi->present = 1;
 		gi->ra_colour = bitvec_get_uint(&bv, 3);
 		gi->si13_position = bitvec_get_uint(&bv, 1);
-	} else
+	} else {
 		gi->present = 0;
+	}
 
 	/* 3G Early Classmark Sending Restriction. If H, then controlled by
 	 * early_cm_ctrl above */

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20651
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia23c4bd018db141ff0afe77fe25678a9b2a395f0
Gerrit-Change-Number: 20651
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201015/aae0859c/attachment.htm>


More information about the gerrit-log mailing list