mirror of https://gerrit.osmocom.org/libosmocore
gsm23003: add osmo_mcc_from_str()
I found myself often using osmo_mnc_from_str() to also decode an MCC and be strict about it, but each time I felt the need to comment like "using osmo_mnc_from_str() also for MCC". Rather formalize this properly. Use a static inline function, no need to add more symbols to libosmo-gsm. Change-Id: I020a4f11791c61742a3d795f782805f7b7e8733e
This commit is contained in:
parent
20f7d0ecb4
commit
4d68fd0955
|
@ -98,5 +98,16 @@ void osmo_plmn_from_bcd(const uint8_t *bcd_src, struct osmo_plmn_id *plmn);
|
|||
|
||||
int osmo_mnc_from_str(const char *mnc_str, uint16_t *mnc, bool *mnc_3_digits);
|
||||
|
||||
/* Convert string to MCC.
|
||||
* \param mcc_str[in] String representation of an MCC, with or without leading zeros.
|
||||
* \param mcc[out] MCC result buffer, or NULL.
|
||||
* \returns zero on success, -EINVAL in case of surplus characters, negative errno in case of conversion
|
||||
* errors. In case of error, do not modify the out-arguments.
|
||||
*/
|
||||
static inline int osmo_mcc_from_str(const char *mcc_str, uint16_t *mcc)
|
||||
{
|
||||
return osmo_mnc_from_str(mcc_str, mcc, NULL);
|
||||
}
|
||||
|
||||
int osmo_mnc_cmp(uint16_t a_mnc, bool a_mnc_3_digits, uint16_t b_mnc, bool b_mnc_3_digits);
|
||||
int osmo_plmn_cmp(const struct osmo_plmn_id *a, const struct osmo_plmn_id *b);
|
||||
|
|
Loading…
Reference in New Issue