symbols: call deinit functions Clear instead of Free

Everywhere else Free is reserved for when the argument is free'd as
well.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-08-28 14:45:03 +03:00
parent 2eba51c0f6
commit 4c56d4d9c0
1 changed files with 9 additions and 10 deletions

View File

@ -121,7 +121,7 @@ InitKeyInfo(KeyInfo *keyi, unsigned file_id)
} }
static void static void
FreeKeyInfo(KeyInfo *keyi) ClearKeyInfo(KeyInfo *keyi)
{ {
xkb_group_index_t i; xkb_group_index_t i;
@ -219,15 +219,14 @@ InitSymbolsInfo(SymbolsInfo * info, struct xkb_keymap *keymap,
} }
static void static void
FreeSymbolsInfo(SymbolsInfo * info) ClearSymbolsInfo(SymbolsInfo * info)
{ {
KeyInfo *keyi; KeyInfo *keyi;
ModMapEntry *mm, *next; ModMapEntry *mm, *next;
free(info->name); free(info->name);
darray_foreach(keyi, info->keys) { darray_foreach(keyi, info->keys)
FreeKeyInfo(keyi); ClearKeyInfo(keyi);
}
darray_free(info->keys); darray_free(info->keys);
list_foreach_safe(mm, next, &info->modMaps, entry) list_foreach_safe(mm, next, &info->modMaps, entry)
free(mm); free(mm);
@ -757,7 +756,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt)
if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS, if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS,
&rtrn, &merge)) { &rtrn, &merge)) {
info->errorCount += 10; info->errorCount += 10;
FreeSymbolsInfo(&included); ClearSymbolsInfo(&included);
return false; return false;
} }
@ -772,12 +771,12 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt)
MergeIncludedSymbols(&included, &next_incl, merge); MergeIncludedSymbols(&included, &next_incl, merge);
FreeSymbolsInfo(&next_incl); ClearSymbolsInfo(&next_incl);
FreeXkbFile(rtrn); FreeXkbFile(rtrn);
} }
MergeIncludedSymbols(info, &included, merge); MergeIncludedSymbols(info, &included, merge);
FreeSymbolsInfo(&included); ClearSymbolsInfo(&included);
return (info->errorCount == 0); return (info->errorCount == 0);
} }
@ -1964,10 +1963,10 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
if (!CopyModMapDef(&info, mm)) if (!CopyModMapDef(&info, mm))
info.errorCount++; info.errorCount++;
FreeSymbolsInfo(&info); ClearSymbolsInfo(&info);
return true; return true;
err_info: err_info:
FreeSymbolsInfo(&info); ClearSymbolsInfo(&info);
return false; return false;
} }