[Ocfs2-tools-devel] [PATCH] o2cb_ctl: clean up deadcode in jconfig.c
Joseph Qi
jiangqi903 at gmail.com
Mon Nov 21 03:23:35 PST 2016
Could we leave these for future use?
Thanks,
Joseph
On 16/11/18 19:15, piaojun wrote:
> Hi,
>
> Could anyone help reviewing my patch?
>
> thanks,
> Jun
>
> On 2016-10-17 10:53, piaojun wrote:
>> j_config_delete_stanza_nth() and j_config_delete() is never used.
>>
>> Signed-off-by: Jun Piao <piaojun at huawei.com>
>> ---
>> o2cb_ctl/jconfig.c | 97 ------------------------------------------------------
>> 1 file changed, 97 deletions(-)
>>
>> diff --git a/o2cb_ctl/jconfig.c b/o2cb_ctl/jconfig.c
>> index 0cb90d1..f117fba 100644
>> --- a/o2cb_ctl/jconfig.c
>> +++ b/o2cb_ctl/jconfig.c
>> @@ -1089,103 +1089,6 @@ JConfigStanza *j_config_add_stanza(JConfig *cf,
>> return(cfs);
>> } /* j_config_add_stanza() */
>>
>> -
>> -/*
>> - * void j_config_delete_stanza(JConfig *cf,
>> - * JConfigStanza *cfs)
>> - *
>> - * Removes the stanza pointed to by cfs from the configuration.
>> - */
>> -void j_config_delete_stanza(JConfig *cf,
>> - JConfigStanza *cfs)
>> -{
>> - GList *elem, *new_elem;
>> - gpointer orig_key;
>> - gchar *orig_data;
>> -
>> - g_return_if_fail(cf != NULL);
>> - g_return_if_fail(cfs != NULL);
>> -
>> - elem = (GList *)g_hash_table_lookup(cf->stanzas, cfs->stanza_name);
>> - if (elem == NULL)
>> - {
>> -#if DEBUG
>> - g_warning("Unable to remove stanza - no such class: %s\n",
>> - cfs->stanza_name);
>> -#endif
>> - return;
>> - }
>> -
>> - new_elem = g_list_remove(elem, cfs);
>> - if (elem == NULL)
>> - {
>> - if (g_hash_table_lookup_extended(cf->stanzas,
>> - cfs->stanza_name,
>> - &orig_key,
>> - NULL))
>> - {
>> - g_hash_table_remove(cf->stanzas, cfs->stanza_name);
>> - g_free(orig_key);
>> - }
>> -
>> - elem = cf->stanza_names;
>> - while (elem != NULL)
>> - {
>> - orig_data = (gchar *)elem->data;
>> - if (strcmp(cfs->stanza_name, orig_data) == 0)
>> - {
>> - cf->stanza_names =
>> - g_list_remove(cf->stanza_names, elem->data);
>> - g_free(orig_data);
>> - break;
>> - }
>> - elem = g_list_next(elem);
>> - }
>> - }
>> - else if (elem != new_elem)
>> - {
>> - if (g_hash_table_lookup_extended(cf->stanzas,
>> - cfs->stanza_name,
>> - &orig_key,
>> - NULL))
>> - {
>> - g_hash_table_remove(cf->stanzas, cfs->stanza_name);
>> - g_free(orig_key);
>> - }
>> - g_hash_table_insert(cf->stanzas,
>> - g_strdup(cfs->stanza_name),
>> - new_elem);
>> - }
>> -
>> - j_config_free_stanza(cfs);
>> -} /* j_config_delete_stanza() */
>> -
>> -
>> -/*
>> - * void j_config_delete_stanza_nth(JConfig *cf,
>> - * const gchar *stanza_name,
>> - * guint n)
>> - *
>> - * Removes the nth stanza of class stanza_name from the
>> - * configuration.
>> - */
>> -void j_config_delete_stanza_nth(JConfig *cf,
>> - const gchar *stanza_name,
>> - guint n)
>> -{
>> - JConfigStanza *cfs;
>> -
>> - g_return_if_fail(cf != NULL);
>> - g_return_if_fail(stanza_name != NULL);
>> -
>> - cfs = j_config_get_stanza_nth(cf, stanza_name, n);
>> - if (cfs == NULL)
>> - return;
>> -
>> - j_config_delete_stanza(cf, cfs);
>> -} /* j_config_delete_stanza() */
>> -
>> -
>> /*
>> * JConfig *j_config_parse_file_with_context(JConfigCtxt *cfc,
>> * const gchar *filename)
>>
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
More information about the Ocfs2-tools-devel
mailing list