[Gluster-devel] Found duplicate branches for 'if' and 'else'

Atin Mukherjee amukherj at redhat.com
Wed Aug 13 05:16:41 UTC 2014



On 08/12/2014 08:25 AM, Ruoyu wrote:
> 
> On 2014年08月12日 10:33, Ruoyu wrote:
>> Hi gluster developers,
>>
>> In the file cli/src/cli-rpc-ops.c, at line 4611, duplicated branches
>> for if and else is found. Is it a typo?
Yes it is :) You can send in a fix for this following the guideline link
shared by Pranith.
>>
>> 4607                 case GF_GSYNC_OPTION_TYPE_STATUS:
>> 4608                         status_detail = dict_get_str_boolean (dict,
>> 4609                                                              
>> "status-detail",
>> 4610                                                              
>> _gf_false);
>> 4611                         if (status_detail)
>> 4612                                 ret = gf_cli_gsync_status_output
>> (dict, status_detail);
>> 4613                         else
>> 4614                                 ret = gf_cli_gsync_status_output
>> (dict, status_detail);
>> 4615                 break;
>>
> Another case, in the file
> xlators/features/snapview-server/src/snapview-server.c, line 268. Both
> of the two branches are same.
> 
>  268         if ((priv->num_snaps == 0) &&
>  269             (snapcount != 0)) {
>  270                 /* first time we are fetching snap list */
>  271                 dirents = GF_CALLOC (snapcount, sizeof (snap_dirent_t),
>  272                                      gf_svs_mt_dirents_t);
>  273                 if (!dirents) {
>  274                         gf_log (frame->this->name, GF_LOG_ERROR,
>  275                                 "Unable to allocate memory");
>  276                         errno = ENOMEM;
>  277                         ret = -1;
>  278                         goto unlock;
>  279                 }
>  280         } else {
>  281                 /* fetch snaplist dynamically at run-time */
>  282                 dirents = GF_CALLOC (snapcount, sizeof (snap_dirent_t),
>  283                                      gf_svs_mt_dirents_t);
>  284                 if (!dirents) {
>  285                         gf_log (frame->this->name, GF_LOG_ERROR,
>  286                                 "Unable to allocate memory");
>  287                                 errno = ENOMEM;
>  288                                 ret = -1;
>  289                                 goto unlock;
>  290                 }
>  291         }
> 
> 
> 
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-devel
> 


More information about the Gluster-devel mailing list