Add set_consume which always takes ownership

Freeing in error path is the common pattern with set_put().
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-04-24 00:25:04 -04:00
parent c79bb9e4e2
commit ef42202ac8
14 changed files with 40 additions and 59 deletions
+2 -4
View File
@@ -178,11 +178,9 @@ static int mark_symlink_for_removal(
path_kill_slashes(n);
r = set_put(*remove_symlinks_to, n);
if (r < 0) {
free(n);
r = set_consume(*remove_symlinks_to, n);
if (r < 0)
return r == -EEXIST ? 0 : r;
}
return 0;
}