Use g_auto(GStrv) instead of glnx_strfreev

tingping/wmclass
Alexander Larsson 2015-08-31 09:51:48 +02:00
parent bfeaccb822
commit 6775dc1002
13 changed files with 44 additions and 44 deletions

View File

@ -48,7 +48,7 @@ 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;
glnx_strfreev char **parts = NULL;
g_auto(GStrv) parts = NULL;
keyfile = g_key_file_new ();
path = g_file_get_path (file);

View File

@ -57,7 +57,7 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
g_autoptr(GKeyFile) metakey = NULL;
g_autoptr(GKeyFile) runtime_metakey = NULL;
g_autoptr(GPtrArray) argv_array = NULL;
glnx_strfreev char **envp = NULL;
g_auto(GStrv) envp = NULL;
gsize metadata_size;
const char *directory = NULL;
const char *command = "/bin/sh";

View File

@ -43,7 +43,7 @@ xdg_app_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
GOptionContext *context;
gboolean ret = FALSE;
g_autoptr(XdgAppDir) dir = NULL;
glnx_strfreev char **remotes = NULL;
g_auto(GStrv) remotes = NULL;
guint ii, n_remotes = 0;
context = g_option_context_new (" - List remote repositories");

View File

@ -55,8 +55,8 @@ print_installed_refs (const char *kind, gboolean print_system, gboolean print_us
{
gboolean ret = FALSE;
g_autofree char *last = NULL;
glnx_strfreev char **system = NULL;
glnx_strfreev char **user = NULL;
g_auto(GStrv) system = NULL;
g_auto(GStrv) user = NULL;
int s, u;
if (print_user)
@ -84,7 +84,7 @@ print_installed_refs (const char *kind, gboolean print_system, gboolean print_us
for (s = 0, u = 0; system[s] != NULL || user[u] != NULL; )
{
char *ref;
glnx_strfreev char **parts = NULL;
g_auto(GStrv) parts = NULL;
g_autofree char *repo = NULL;
gboolean is_user;
g_autoptr(XdgAppDir) dir = NULL;

View File

@ -78,8 +78,8 @@ static gboolean
add_extension_args (GKeyFile *metakey, const char *full_ref,
GPtrArray *argv_array, GCancellable *cancellable, GError **error)
{
glnx_strfreev gchar **groups = NULL;
glnx_strfreev gchar **parts = NULL;
g_auto(GStrv) groups = NULL;
g_auto(GStrv) parts = NULL;
gboolean ret = FALSE;
int i;
@ -109,7 +109,7 @@ add_extension_args (GKeyFile *metakey, const char *full_ref,
"subdirectories", NULL))
{
g_autofree char *prefix = g_strconcat (extension, ".", NULL);
glnx_strfreev char **refs = NULL;
g_auto(GStrv) refs = NULL;
int i;
refs = xdg_app_list_deployed_refs (parts[0], prefix, parts[2], parts[3],
@ -165,7 +165,7 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **
g_autoptr(GKeyFile) metakey = NULL;
g_autoptr(GKeyFile) runtime_metakey = NULL;
g_autoptr(GPtrArray) argv_array = NULL;
glnx_strfreev char **envp = NULL;
g_auto(GStrv) envp = NULL;
g_autoptr(GPtrArray) dbus_proxy_argv = NULL;
g_autofree char *monitor_path = NULL;
const char *app;

View File

@ -57,7 +57,7 @@ xdg_app_builtin_uninstall_runtime (int argc, char **argv, GCancellable *cancella
const char *branch;
g_autofree char *ref = NULL;
g_autofree char *repository = NULL;
glnx_strfreev char **deployed = NULL;
g_auto(GStrv) deployed = NULL;
int i;
GError *temp_error = NULL;
@ -187,7 +187,7 @@ xdg_app_builtin_uninstall_app (int argc, char **argv, GCancellable *cancellable,
g_autofree char *ref = NULL;
g_autofree char *repository = NULL;
g_autofree char *current_ref = NULL;
glnx_strfreev char **deployed = NULL;
g_auto(GStrv) deployed = NULL;
int i;
GError *temp_error = NULL;

View File

@ -211,7 +211,7 @@ get_app_name_from_id (guint32 id)
static void
fill_app_name_hash (void)
{
glnx_strfreev char **keys = NULL;
g_auto(GStrv) keys = NULL;
int i;
keys = xdp_list_apps ();

View File

@ -47,7 +47,7 @@ guint32 *
xdp_list_docs (void)
{
GArray *res;
glnx_strfreev char **ids;
g_auto(GStrv) ids = NULL;
guint32 id;
int i;
@ -224,7 +224,7 @@ do_create_doc (const char *path)
{
g_autoptr(GVariant) data = g_variant_ref_sink (g_variant_new_bytestring (path));
g_autoptr (XdgAppDbEntry) entry = NULL;
glnx_strfreev char **ids = NULL;
g_auto(GStrv) ids = NULL;
char *id = NULL;
ids = xdg_app_db_list_ids_by_value (db, data);

View File

@ -718,8 +718,8 @@ xdg_app_db_update (XdgAppDb *self)
GBytes *new_contents;
GvdbTable *new_gvdb;
int i;
glnx_strfreev char **ids = NULL;
glnx_strfreev char **apps = NULL;
g_auto(GStrv) ids = NULL;
g_auto(GStrv) apps = NULL;
g_return_if_fail (XDG_APP_IS_DB (self));
@ -745,7 +745,7 @@ xdg_app_db_update (XdgAppDb *self)
apps = xdg_app_db_list_apps (self);
for (i = 0; apps[i] != 0; i++)
{
glnx_strfreev char **app_ids = xdg_app_db_list_ids_by_app (self, apps[i]);
g_auto(GStrv) app_ids = xdg_app_db_list_ids_by_app (self, apps[i]);
GVariantBuilder builder;
GvdbItem *item;
int j;
@ -879,8 +879,8 @@ GString *
xdg_app_db_print_string (XdgAppDb *self,
GString *string)
{
glnx_strfreev char **ids = NULL;
glnx_strfreev char **apps = NULL;
g_auto(GStrv) ids = NULL;
g_auto(GStrv) apps = NULL;
int i;
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
@ -908,7 +908,7 @@ xdg_app_db_print_string (XdgAppDb *self,
for (i = 0; apps[i] != 0; i++)
{
int j;
glnx_strfreev char **app_ids = NULL;
g_auto(GStrv) app_ids = NULL;
app_ids = xdg_app_db_list_ids_by_app (self, apps[i]);
sort_strv ((const char **)app_ids);

View File

@ -465,7 +465,7 @@ xdg_app_dir_make_current_ref (XdgAppDir *self,
g_autoptr(GFile) base = NULL;
g_autoptr(GFile) dir = NULL;
g_autoptr(GFile) current_link = NULL;
glnx_strfreev char **ref_parts = NULL;
g_auto(GStrv) ref_parts = NULL;
g_autofree char *rest = NULL;
gboolean ret = FALSE;
@ -926,8 +926,8 @@ export_desktop_file (const char *app,
g_autoptr(GKeyFile) keyfile = NULL;
g_autofree gchar *old_exec = NULL;
gint old_argc;
glnx_strfreev gchar **old_argv = NULL;
glnx_strfreev gchar **groups = NULL;
g_auto(GStrv) old_argv = NULL;
g_auto(GStrv) groups = NULL;
GString *new_exec = NULL;
g_autofree char *escaped_app = maybe_quote (app);
g_autofree char *escaped_branch = maybe_quote (branch);
@ -1429,7 +1429,7 @@ xdg_app_dir_deploy (XdgAppDir *self,
export = g_file_get_child (checkoutdir, "export");
if (g_file_query_exists (export, cancellable))
{
glnx_strfreev char **ref_parts = NULL;
g_auto(GStrv) ref_parts = NULL;
ref_parts = g_strsplit (ref, "/", -1);
@ -1624,7 +1624,7 @@ xdg_app_dir_undeploy (XdgAppDir *self,
active = xdg_app_dir_read_active (self, ref, cancellable);
if (active != NULL && strcmp (active, checksum) == 0)
{
glnx_strfreev char **deployed_checksums = NULL;
g_auto(GStrv) deployed_checksums = NULL;
const char *some_deployment;
/* We're removing the active deployment, start by repointing that

View File

@ -548,7 +548,7 @@ option_env_cb (const gchar *option_name,
GError **error)
{
XdgAppContext *context = data;
glnx_strfreev char **split = g_strsplit (value, "=", 2);
g_auto(GStrv) split = g_strsplit (value, "=", 2);
if (split == NULL || split[0] == NULL || split[0][0] == 0 || split[1] == NULL)
{
@ -643,7 +643,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_key (metakey, XDG_APP_METADATA_GROUP_CONTEXT, XDG_APP_METADATA_KEY_SHARED, NULL))
{
glnx_strfreev char **shares = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
g_auto(GStrv) shares = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
XDG_APP_METADATA_KEY_SHARED, NULL, error);
if (shares == NULL)
return FALSE;
@ -659,7 +659,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_key (metakey, XDG_APP_METADATA_GROUP_CONTEXT, XDG_APP_METADATA_KEY_SOCKETS, NULL))
{
glnx_strfreev char **sockets = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
g_auto(GStrv) sockets = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
XDG_APP_METADATA_KEY_SOCKETS, NULL, error);
if (sockets == NULL)
return FALSE;
@ -675,7 +675,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_key (metakey, XDG_APP_METADATA_GROUP_CONTEXT, XDG_APP_METADATA_KEY_DEVICES, NULL))
{
glnx_strfreev char **devices = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
g_auto(GStrv) devices = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
XDG_APP_METADATA_KEY_DEVICES, NULL, error);
if (devices == NULL)
return FALSE;
@ -692,7 +692,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_key (metakey, XDG_APP_METADATA_GROUP_CONTEXT, XDG_APP_METADATA_KEY_FILESYSTEMS, NULL))
{
glnx_strfreev char **filesystems = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
g_auto(GStrv) filesystems = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
XDG_APP_METADATA_KEY_FILESYSTEMS, NULL, error);
if (filesystems == NULL)
return FALSE;
@ -707,7 +707,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_key (metakey, XDG_APP_METADATA_GROUP_CONTEXT, XDG_APP_METADATA_KEY_PERSISTENT, NULL))
{
glnx_strfreev char **persistent = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
g_auto(GStrv) persistent = g_key_file_get_string_list (metakey, XDG_APP_METADATA_GROUP_CONTEXT,
XDG_APP_METADATA_KEY_PERSISTENT, NULL, error);
if (persistent == NULL)
return FALSE;
@ -718,7 +718,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_group (metakey, XDG_APP_METADATA_GROUP_SESSION_BUS_POLICY))
{
glnx_strfreev char **keys = NULL;
g_auto(GStrv) keys = NULL;
gsize i, keys_count;
keys = g_key_file_get_keys (metakey, XDG_APP_METADATA_GROUP_SESSION_BUS_POLICY, &keys_count, NULL);
@ -741,7 +741,7 @@ xdg_app_context_load_metadata (XdgAppContext *context,
if (g_key_file_has_group (metakey, XDG_APP_METADATA_GROUP_ENVIRONMENT))
{
glnx_strfreev char **keys = NULL;
g_auto(GStrv) keys = NULL;
gsize i, keys_count;
keys = g_key_file_get_keys (metakey, XDG_APP_METADATA_GROUP_ENVIRONMENT, &keys_count, NULL);
@ -761,9 +761,9 @@ void
xdg_app_context_save_metadata (XdgAppContext *context,
GKeyFile *metakey)
{
glnx_strfreev char **shared = xdg_app_context_shared_to_string (context->shares);
glnx_strfreev char **sockets = xdg_app_context_sockets_to_string (context->sockets);
glnx_strfreev char **devices = xdg_app_context_devices_to_string (context->devices);
g_auto(GStrv) shared = xdg_app_context_shared_to_string (context->shares);
g_auto(GStrv) sockets = xdg_app_context_sockets_to_string (context->sockets);
g_auto(GStrv) devices = xdg_app_context_devices_to_string (context->devices);
GHashTableIter iter;
gpointer key, value;

View File

@ -146,7 +146,7 @@ handle_list (XdgAppPermissionStore *object,
const gchar *table_name)
{
Table *table;
glnx_strfreev char **ids = NULL;
g_auto(GStrv) ids = NULL;
table = lookup_table (table_name, invocation);
if (table == NULL)

View File

@ -33,13 +33,13 @@ create_test_db (gboolean serialized)
g_assert (db != NULL);
{
glnx_strfreev char **ids = xdg_app_db_list_ids (db);
g_auto(GStrv) ids = xdg_app_db_list_ids (db);
g_assert (ids != NULL);
g_assert (ids[0] == NULL);
}
{
glnx_strfreev char **apps = xdg_app_db_list_apps (db);
g_auto(GStrv) apps = xdg_app_db_list_apps (db);
g_assert (apps != NULL);
g_assert (apps[0] == NULL);
}
@ -66,10 +66,10 @@ create_test_db (gboolean serialized)
static void
verify_test_db (XdgAppDb *db)
{
glnx_strfreev char **ids;
g_auto(GStrv) ids;
g_autofree const char **apps1 = NULL;
g_autofree const char **apps2 = NULL;
glnx_strfreev char **all_apps = NULL;
g_auto(GStrv) all_apps = NULL;
ids = xdg_app_db_list_ids (db);
g_assert (g_strv_length (ids) == 2);
@ -266,7 +266,7 @@ test_modify (void)
g_autoptr(XdgAppDbEntry) entry6 = NULL;
g_autoptr(XdgAppDbEntry) entry7 = NULL;
g_autofree const char **apps2 = NULL;
glnx_strfreev char **apps3 = NULL;
g_auto(GStrv) apps3 = NULL;
g_autofree const char **permissions1 = NULL;
g_autofree const char **permissions2 = NULL;
g_autofree const char **permissions3 = NULL;
@ -309,7 +309,7 @@ test_modify (void)
g_autoptr(XdgAppDbEntry) entry6 = NULL;
g_autoptr(XdgAppDbEntry) entry7 = NULL;
g_autofree const char **apps2 = NULL;
glnx_strfreev char **apps3 = NULL;
g_auto(GStrv) apps3 = NULL;
g_autofree const char **permissions1 = NULL;
g_autofree const char **permissions2 = NULL;
g_autofree const char **permissions3 = NULL;