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

Ruoyu liangry at ucweb.com
Tue Aug 12 02:55:43 UTC 2014


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?
>
> 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         }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20140812/6a3baabe/attachment.html>


More information about the Gluster-devel mailing list