From: Ran Benita Date: Sun, 9 Feb 2014 15:18:08 +0000 (+0200) Subject: symbols: steal keys and modmaps when merging if possible X-Git-Tag: xkbcommon-0.4.1~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71a25931620c62a1ca98c620bdc24edd544c31d7;p=platform%2Fupstream%2Flibxkbcommon.git symbols: steal keys and modmaps when merging if possible Signed-off-by: Ran Benita --- diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index b57d02c..87f56db 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -509,16 +509,28 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_foreach_from(group_name, from->group_names, group_names_in_both) darray_append(into->group_names, *group_name); - darray_foreach(keyi, from->keys) { - keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); - if (!AddKeySymbols(into, keyi, false)) - into->errorCount++; + if (darray_empty(into->keys)) { + into->keys = from->keys; + darray_init(from->keys); + } + else { + darray_foreach(keyi, from->keys) { + keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); + if (!AddKeySymbols(into, keyi, false)) + into->errorCount++; + } } - darray_foreach(mm, from->modmaps) { - mm->merge = (merge == MERGE_DEFAULT ? mm->merge : merge); - if (!AddModMapEntry(into, mm)) - into->errorCount++; + if (darray_empty(into->modmaps)) { + into->modmaps = from->modmaps; + darray_init(from->modmaps); + } + else { + darray_foreach(mm, from->modmaps) { + mm->merge = (merge == MERGE_DEFAULT ? mm->merge : merge); + if (!AddModMapEntry(into, mm)) + into->errorCount++; + } } }