Re: [MM] [PATCH] modem-helpers: handle the case when operator name is "Unknown"



On 09/19/2012 10:15 PM, Ben Chan wrote:
> +        /* Some modems (Novatel LTE) return the operator name as "Unknown" when
> +         * it fails to obtain the operator name. Return NULL in such case.
> +         */
> +        casefolded_operator = g_utf8_casefold (operator, -1);
> +        if (g_utf8_collate (casefolded_operator, "unknown") == 0) {
> +            g_free (operator);
>              operator = NULL;
>          }
> +        g_free (casefolded_operator);


Given that you're going to compare the string with an ASCII string, it's
probably just better to use g_ascii_strcasecmp() and skip completely the
extra allocated string.

-- 
Aleksander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]