Skip to content

Commit

Permalink
Remove extra newlines in variable definiton blocks
Browse files Browse the repository at this point in the history
Uncrustify has an option "nl_func_var_def_blk" which is supposed to
ensure there's a newline character between the block of variable
definitions and the rest of the function body, but it gets confused and
thinks that the first instance of "g_autoptr" or "g_auto" being used on
a variable is the start of the function body. So this commit removes
those extra newline characters and removes that option in uncrustify.cfg
so they don't get re-added the next time uncrustify is run.

Here's the command I used:

perl -0777 -i -pe 's/\n(\n\s*g_auto\()/\1/g' `git ls-tree --name-only
-r HEAD | grep \\\.[ch]$ | grep -v common/valgrind-private.h |
grep -v app/flatpak-polkit-agent-text-listener\\\.[ch]`

I ran it again with "g_autoptr" in place of "g_auto", and made a few
manual edits to add back the newline when the g_auto* was in the middle
of a function body rather than at the top.

Closes: flatpak#2715
Approved by: matthiasclasen
  • Loading branch information
mwleeds authored and rh-atomic-bot committed Feb 25, 2019
1 parent a0d3d65 commit e8816b7
Show file tree
Hide file tree
Showing 38 changed files with 0 additions and 173 deletions.
1 change: 0 additions & 1 deletion app/flatpak-builtins-build-bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ build_bundle (OstreeRepo *repo, GFile *file,
{
GVariantBuilder metadata_builder;
GVariantBuilder param_builder;

g_autoptr(GKeyFile) keyfile = NULL;
g_autoptr(GBytes) xml_data = NULL;
g_autoptr(GFile) metadata_file = NULL;
Expand Down
5 changes: 0 additions & 5 deletions app/flatpak-builtins-build-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ static gboolean
metadata_get_arch (GFile *file, char **out_arch, GError **error)
{
g_autofree char *path = NULL;

g_autoptr(GKeyFile) keyfile = NULL;
g_autofree char *runtime = NULL;
g_auto(GStrv) parts = NULL;
Expand Down Expand Up @@ -440,7 +439,6 @@ validate_desktop_file (GFile *desktop_file,
GError **error)
{
g_autofree char *path = g_file_get_path (desktop_file);

g_autoptr(GSubprocess) subprocess = NULL;
g_autofree char *stdout_buf = NULL;
g_autofree char *stderr_buf = NULL;
Expand Down Expand Up @@ -545,7 +543,6 @@ validate_service_file (GFile *service_file,
GError **error)
{
g_autofree char *path = g_file_get_path (service_file);

g_autoptr(GKeyFile) key_file = NULL;
g_autofree char *name = NULL;
g_autofree char *command = NULL;
Expand Down Expand Up @@ -604,7 +601,6 @@ static gboolean
validate_exports (GFile *export, GFile *files, const char *app_id, GError **error)
{
g_autofree char *desktop_path = NULL;

g_autoptr(GFile) desktop_file = NULL;
g_autofree char *service_path = NULL;
g_autoptr(GFile) service_file = NULL;
Expand Down Expand Up @@ -747,7 +743,6 @@ gboolean
flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;

g_autoptr(GOptionContext) context = NULL;
g_autoptr(GFile) base = NULL;
g_autoptr(GFile) files = NULL;
Expand Down
2 changes: 0 additions & 2 deletions app/flatpak-builtins-build-finish.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export_dir (int source_parent_fd,
GError **error)
{
int res;

g_auto(GLnxDirFdIterator) source_iter = {0};
glnx_autofd int destination_dfd = -1;
struct dirent *dent;
Expand Down Expand Up @@ -293,7 +292,6 @@ static gboolean
update_metadata (GFile *base, FlatpakContext *arg_context, gboolean is_runtime, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;

g_autoptr(GFile) metadata = NULL;
g_autofree char *path = NULL;
g_autoptr(GKeyFile) keyfile = NULL;
Expand Down
1 change: 0 additions & 1 deletion app/flatpak-builtins-build-import-bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import_oci (OstreeRepo *repo, GFile *file,
g_autofree char *dir_uri = NULL;
g_autofree char *target_ref = NULL;
const char *oci_digest;

g_autoptr(FlatpakOciRegistry) registry = NULL;
g_autoptr(FlatpakOciVersioned) versioned = NULL;
FlatpakOciManifest *manifest = NULL;
Expand Down
2 changes: 0 additions & 2 deletions app/flatpak-builtins-create-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ ostree_create_usb (GOptionContext *context,
OstreeRepoMode mode = OSTREE_REPO_MODE_ARCHIVE;

g_debug ("%s: Creating repository in mode %u", G_STRFUNC, mode);

g_autoptr(OstreeRepo) dest_repo = ostree_repo_create_at (mount_root_dfd, dest_repo_path,
mode, NULL, cancellable, error);

Expand All @@ -307,7 +306,6 @@ ostree_create_usb (GOptionContext *context,
GLNX_HASH_TABLE_FOREACH_KV (all_refs, OstreeCollectionRef *, c_r, CommitAndSubpaths *, c_s)
{
GVariantBuilder builder;

g_autoptr(GVariant) opts = NULL;
OstreeRepoPullFlags flags = OSTREE_REPO_PULL_FLAGS_MIRROR;
GVariantBuilder refs_builder;
Expand Down
2 changes: 0 additions & 2 deletions app/flatpak-builtins-remote-ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
guint n_keys;
g_autofree const char **keys = NULL;
int i, j;

g_autoptr(GHashTable) pref_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
FlatpakKinds match_kinds;
g_autofree char *match_id = NULL;
Expand Down Expand Up @@ -151,7 +150,6 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
FlatpakRemoteState *state = remote_state_dir_pair->state;
const char *remote = state->remote_name;
g_autoptr(AsStore) store = NULL;

g_autoptr(GHashTable) names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);

g_hash_table_iter_init (&iter, refs);
Expand Down
1 change: 0 additions & 1 deletion app/flatpak-builtins-repair.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ fsck_dirtree (OstreeRepo *repo,
GHashTable *object_status_cache)
{
OstreeRepoCommitIterResult iterres;

g_autoptr(GError) local_error = NULL;
FsckStatus status = 0;
g_autoptr(GVariant) key = NULL;
Expand Down
1 change: 0 additions & 1 deletion app/flatpak-builtins-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ print_commits (OstreeRepo *repo,
GError **error)
{
g_autofree char *checksum = NULL;

g_autoptr(GPtrArray) deltas = NULL;

if (!ostree_repo_list_static_delta_names (repo, &deltas, NULL, error))
Expand Down
1 change: 0 additions & 1 deletion app/flatpak-builtins-uninstall.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ flatpak_delete_data (gboolean opt_yes,
GError **error)
{
g_autofree char *path = g_build_filename (g_get_home_dir (), ".var", "app", app_id, NULL);

g_autoptr(GFile) file = g_file_new_for_path (path);

if (!opt_yes &&
Expand Down
5 changes: 0 additions & 5 deletions app/flatpak-builtins-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ download_uri (const char *url,
GError **error)
{
SoupSession *session;

g_autoptr(SoupRequest) req = NULL;
g_autoptr(GInputStream) input = NULL;
g_autoptr(GOutputStream) out = NULL;
Expand Down Expand Up @@ -160,7 +159,6 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
g_autofree char *id = NULL;
g_autofree char *arch = NULL;
g_autofree char *branch = NULL;

g_autoptr(GError) lookup_error = NULL;
FlatpakDir *dir = NULL;
g_autofree char *ref = NULL;
Expand Down Expand Up @@ -629,7 +627,6 @@ get_file_age (GFile *file)
{
guint64 now;
guint64 mtime;

g_autoptr(GFileInfo) info = NULL;

info = g_file_query_info (file,
Expand Down Expand Up @@ -1180,7 +1177,6 @@ flatpak_dir_load_appstream_store (FlatpakDir *self,
GError **error)
{
const char *install_path = flatpak_file_get_path_cached (flatpak_dir_get_path (self));

g_autoptr(GFile) appstream_file = NULL;
g_autofree char *appstream_path = NULL;
g_autoptr(GError) local_error = NULL;
Expand Down Expand Up @@ -1345,7 +1341,6 @@ print_wrapped (int cols,
{
va_list args;
g_autofree char *msg = NULL;

g_auto(GStrv) lines = NULL;
int i;

Expand Down
4 changes: 0 additions & 4 deletions app/flatpak-cli-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ progress_changed_cb (FlatpakTransactionProgress *progress,
FlatpakCliTransaction *cli = data;
FlatpakTransaction *self = FLATPAK_TRANSACTION (cli);
FlatpakTransactionOperation *op = flatpak_transaction_get_current_operation (self);

g_autoptr(GString) str = g_string_new ("");
int i;
int n_full, partial;
Expand Down Expand Up @@ -439,7 +438,6 @@ operation_error (FlatpakTransaction *transaction,
FlatpakCliTransaction *self = FLATPAK_CLI_TRANSACTION (transaction);
FlatpakTransactionOperationType op_type = flatpak_transaction_operation_get_operation_type (op);
const char *ref = flatpak_transaction_operation_get_ref (op);

g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
g_autofree char *msg = NULL;
gboolean non_fatal = (detail & FLATPAK_TRANSACTION_ERROR_DETAILS_NON_FATAL) != 0;
Expand Down Expand Up @@ -510,7 +508,6 @@ end_of_lifed (FlatpakTransaction *transaction,
const char *rebase)
{
FlatpakCliTransaction *self = FLATPAK_CLI_TRANSACTION (transaction);

g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
g_autofree char *msg = NULL;

Expand Down Expand Up @@ -618,7 +615,6 @@ append_tags (GPtrArray *tags_array,
GKeyFile *old_metadata)
{
gsize i, size = 0;

g_auto(GStrv) tags = g_key_file_get_string_list (metadata, FLATPAK_METADATA_GROUP_APPLICATION, "tags",
&size, NULL);
g_auto(GStrv) old_tags = NULL;
Expand Down
2 changes: 0 additions & 2 deletions app/flatpak-complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ flatpak_complete_partial_ref (FlatpakCompletion *completion,
g_autofree char *id = NULL;
g_autofree char *arch = NULL;
g_autofree char *branch = NULL;

g_auto(GStrv) refs = NULL;
int element;
const char *cur_parts[4] = { NULL };
Expand Down Expand Up @@ -447,7 +446,6 @@ flatpak_complete_columns (FlatpakCompletion *completion,
{
int i;
const char *list = NULL;

g_auto(GStrv) used = NULL;

if (!g_str_has_prefix (completion->cur, "--columns="))
Expand Down
1 change: 0 additions & 1 deletion app/flatpak-table-printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ flatpak_table_printer_print_full (FlatpakTablePrinter *printer,
g_autofree int *lwidths = NULL;
g_autofree int *rwidths = NULL;
g_autofree int *shrinks = NULL;

g_autoptr(GString) row_s = g_string_new ("");
int i, j;
int rows = 0;
Expand Down
1 change: 0 additions & 1 deletion common/flatpak-bundle-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ flatpak_bundle_ref_new (GFile *file,
{
FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
FlatpakBundleRefPrivate *priv;

g_auto(GStrv) parts = NULL;
FlatpakBundleRef *ref;
g_autoptr(GVariant) metadata = NULL;
Expand Down
1 change: 0 additions & 1 deletion common/flatpak-bwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ flatpak_bwrap_bundle_args (FlatpakBwrap *bwrap,
gint i;
gsize data_len = 0;
int fd;

g_auto(GLnxTmpfile) args_tmpf = { 0, };

if (end == -1)
Expand Down
3 changes: 0 additions & 3 deletions common/flatpak-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ flatpak_context_get_session_bus_policy_allowed_own_names (FlatpakContext *contex
{
GHashTableIter iter;
gpointer key, value;

g_autoptr(GPtrArray) names = g_ptr_array_new_with_free_func (g_free);

g_hash_table_iter_init (&iter, context->session_bus_policy);
Expand Down Expand Up @@ -1024,7 +1023,6 @@ option_env_cb (const gchar *option_name,
GError **error)
{
FlatpakContext *context = data;

g_auto(GStrv) split = g_strsplit (value, "=", 2);

if (split == NULL || split[0] == NULL || split[0][0] == 0 || split[1] == NULL)
Expand Down Expand Up @@ -1270,7 +1268,6 @@ flatpak_context_load_metadata (FlatpakContext *context,
GError **error)
{
gboolean remove;

g_auto(GStrv) groups = NULL;
int i;

Expand Down
Loading

0 comments on commit e8816b7

Please sign in to comment.