mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
Use { 0, } for structure initialization rather than memset()
It's cleaner, safer, and I had a totally wrong idea stuck in my head about why memset() should be used. https://bugzilla.gnome.org/show_bug.cgi?id=705968
This commit is contained in:
parent
5f90502482
commit
eaee309112
@ -103,11 +103,9 @@ ostree_repo_prune (OstreeRepo *repo,
|
||||
gs_unref_hashtable GHashTable *objects = NULL;
|
||||
gs_unref_hashtable GHashTable *all_refs = NULL;
|
||||
gs_free char *formatted_freed_size = NULL;
|
||||
OtPruneData data;
|
||||
OtPruneData data = { 0, };
|
||||
gboolean refs_only = flags & OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
|
||||
data.repo = repo;
|
||||
data.reachable = ostree_repo_traverse_new_reachable ();
|
||||
|
||||
|
@ -364,12 +364,11 @@ fetch_uri (OtPullData *pull_data,
|
||||
gboolean ret = FALSE;
|
||||
gs_free char *uri_string = NULL;
|
||||
gs_unref_object SoupRequest *request = NULL;
|
||||
OstreeFetchUriData fetch_data;
|
||||
OstreeFetchUriData fetch_data = { 0, };
|
||||
|
||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
memset (&fetch_data, 0, sizeof (fetch_data));
|
||||
fetch_data.pull_data = pull_data;
|
||||
|
||||
uri_string = soup_uri_to_string (uri, FALSE);
|
||||
@ -1184,7 +1183,7 @@ ostree_repo_pull (OstreeRepo *self,
|
||||
gs_free char *branch_rev = NULL;
|
||||
gs_free char *remote_mode_str = NULL;
|
||||
GSource *queue_src = NULL;
|
||||
OtPullData pull_data_real;
|
||||
OtPullData pull_data_real = { 0, };
|
||||
OtPullData *pull_data = &pull_data_real;
|
||||
SoupURI *summary_uri = NULL;
|
||||
GKeyFile *config = NULL;
|
||||
@ -1194,8 +1193,6 @@ ostree_repo_pull (OstreeRepo *self,
|
||||
guint64 start_time;
|
||||
guint64 end_time;
|
||||
|
||||
memset (pull_data, 0, sizeof (*pull_data));
|
||||
|
||||
pull_data->async_error = error;
|
||||
pull_data->main_context = g_main_context_get_thread_default ();
|
||||
pull_data->loop = g_main_loop_new (pull_data->main_context, FALSE);
|
||||
|
@ -247,7 +247,7 @@ checkout_deployment_tree (GFile *sysroot,
|
||||
gs_unref_object GFile *osdeploy_path = NULL;
|
||||
gs_unref_object GFile *deploy_target_path = NULL;
|
||||
gs_unref_object GFile *deploy_parent = NULL;
|
||||
ProcessOneCheckoutData checkout_data;
|
||||
ProcessOneCheckoutData checkout_data = { 0, };
|
||||
|
||||
root = (OstreeRepoFile*)ostree_repo_file_new_root (repo, csum);
|
||||
if (!ostree_repo_file_ensure_resolved (root, error))
|
||||
@ -272,7 +272,6 @@ checkout_deployment_tree (GFile *sysroot,
|
||||
g_print ("ostadmin: Creating deployment %s\n",
|
||||
gs_file_get_path_cached (deploy_target_path));
|
||||
|
||||
memset (&checkout_data, 0, sizeof (checkout_data));
|
||||
checkout_data.loop = g_main_loop_new (NULL, TRUE);
|
||||
checkout_data.error = error;
|
||||
|
||||
|
@ -61,9 +61,7 @@ ostree_builtin_checksum (int argc, char **argv, GFile *repo_path_path, GCancella
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_object GFile *f = NULL;
|
||||
AsyncChecksumData data;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
AsyncChecksumData data = { 0, };
|
||||
|
||||
context = g_option_context_new ("FILENAME - Checksum a file or directory");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
@ -173,14 +173,12 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GCancellable
|
||||
gs_unref_hashtable GHashTable *commits_to_clone = NULL;
|
||||
gs_unref_hashtable GHashTable *source_objects = NULL;
|
||||
gs_unref_hashtable GHashTable *objects_to_copy = NULL;
|
||||
OtLocalCloneData datav;
|
||||
OtLocalCloneData datav = { 0, };
|
||||
OtLocalCloneData *data = &datav;
|
||||
|
||||
context = g_option_context_new ("SRC_REPO [REFS...] - Copy data from SRC_REPO");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
||||
memset (&datav, 0, sizeof (datav));
|
||||
|
||||
if (!g_option_context_parse (context, &argc, &argv, error))
|
||||
goto out;
|
||||
|
||||
|
@ -284,14 +284,12 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GFile *repo_path, GCancella
|
||||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
const char *dirpath;
|
||||
OtTrivialHttpd appstruct;
|
||||
OtTrivialHttpd appstruct = { 0, };
|
||||
OtTrivialHttpd *app = &appstruct;
|
||||
gs_unref_object GFile *dir = NULL;
|
||||
gs_unref_object SoupServer *server = NULL;
|
||||
gs_unref_object GFileMonitor *dirmon = NULL;
|
||||
|
||||
memset (&appstruct, 0, sizeof (appstruct));
|
||||
|
||||
context = g_option_context_new ("[DIR] - Simple webserver");
|
||||
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user