Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: Don't strip modifiers when stripping encoding #322

Merged
merged 2 commits into from Jun 21, 2021

Commits on Jun 21, 2021

  1. utils: Don't strip modifiers when stripping encoding

    We have some locales which are dupes if we do this, for example
    ca_ES.UTF-8 and ca_ES.UTF-8@valencia. The latter of these should become
    ca_ES@valencia in the output. That is what `locale -a` shows.
    
    Previously `as_locale_strip_encoding ()` modified the passed-in string
    in place. However, in the one place where don't `g_strdup ()` the string
    before passing to this function, it is the key in a `GHashTable`. We
    can't do this, and only get away with it because the hash table isn't
    touched after this call. Fix the function to instead return a newly
    allocated string, and drop the `g_strdup` calls from the other call
    sites.
    
    Add a small test for this function too.
    
    ximion/appstream-generator#92
    Iain Lane committed Jun 21, 2021
  2. utils: Replace as_gstring_replace definition with upstream's

    Until we can depend on 2.68, it's probably best to standardise on one
    implementation - also, this one is much simpler.
    Iain Lane committed Jun 21, 2021