mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
Allow and start using C99 declaration-after-statement
I've seen code in a few places that I think on balance is definitely better this way. Some of our functions have huge variable declaration sections. This change includes one small example where we could start using declarations after statements. A concern I had was - how does this interact with `__attribute__((cleanup))` and early returns? I tested it, and AFAICS the behavior is what you'd expect - the cleanup function isn't called if its variable isn't reachable. Closes: #718 Approved by: jlebon
This commit is contained in:
parent
574c3ea6f9
commit
3219a5d0ee
@ -33,7 +33,6 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\
|
|||||||
-Werror=incompatible-pointer-types \
|
-Werror=incompatible-pointer-types \
|
||||||
-Werror=misleading-indentation \
|
-Werror=misleading-indentation \
|
||||||
-Werror=missing-include-dirs -Werror=aggregate-return \
|
-Werror=missing-include-dirs -Werror=aggregate-return \
|
||||||
-Werror=declaration-after-statement \
|
|
||||||
])
|
])
|
||||||
AC_SUBST(WARN_CFLAGS)
|
AC_SUBST(WARN_CFLAGS)
|
||||||
|
|
||||||
|
@ -4309,16 +4309,14 @@ find_keyring (OstreeRepo *self,
|
|||||||
OstreeRemote *remote,
|
OstreeRemote *remote,
|
||||||
GCancellable *cancellable)
|
GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
g_autoptr(GFile) remotes_d = NULL;
|
g_autoptr(GFile) file = g_file_get_child (self->repodir, remote->keyring);
|
||||||
g_autoptr(GFile) file = NULL;
|
|
||||||
file = g_file_get_child (self->repodir, remote->keyring);
|
|
||||||
|
|
||||||
if (g_file_query_exists (file, cancellable))
|
if (g_file_query_exists (file, cancellable))
|
||||||
{
|
{
|
||||||
return g_steal_pointer (&file);
|
return g_steal_pointer (&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
remotes_d = get_remotes_d_dir (self);
|
g_autoptr(GFile) remotes_d = get_remotes_d_dir (self);
|
||||||
if (remotes_d)
|
if (remotes_d)
|
||||||
{
|
{
|
||||||
g_autoptr(GFile) file2 = g_file_get_child (remotes_d, remote->keyring);
|
g_autoptr(GFile) file2 = g_file_get_child (remotes_d, remote->keyring);
|
||||||
|
Loading…
Reference in New Issue
Block a user