svcauth_gss: replace a trivial 'switch' with an 'if'

Code like:

  switch(xxx) {
  case -error1:
  case -error2:
     ..
     return;
  case 0:
     stuff;
  }

  can more naturally be written:

  if (xxx < 0)
      return;

  stuff;

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
NeilBrown 2010-08-12 17:04:07 +10:00 коммит произвёл J. Bruce Fields
Родитель 839049a873
Коммит 2ed5282cd9
1 изменённых файлов: 19 добавлений и 22 удалений

Просмотреть файл

@ -1034,30 +1034,27 @@ static int svcauth_gss_handle_init(struct svc_rqst *rqstp,
rsi_free(&rsikey); rsi_free(&rsikey);
if (!rsip) if (!rsip)
return SVC_CLOSE; return SVC_CLOSE;
switch (cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) { if (cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle) < 0)
case -EAGAIN:
case -ETIMEDOUT:
case -ENOENT:
/* No upcall result: */ /* No upcall result: */
return SVC_CLOSE; return SVC_CLOSE;
case 0:
ret = SVC_CLOSE; ret = SVC_CLOSE;
/* Got an answer to the upcall; use it: */ /* Got an answer to the upcall; use it: */
if (gss_write_init_verf(rqstp, rsip)) if (gss_write_init_verf(rqstp, rsip))
goto out; goto out;
if (resv->iov_len + 4 > PAGE_SIZE) if (resv->iov_len + 4 > PAGE_SIZE)
goto out; goto out;
svc_putnl(resv, RPC_SUCCESS); svc_putnl(resv, RPC_SUCCESS);
if (svc_safe_putnetobj(resv, &rsip->out_handle)) if (svc_safe_putnetobj(resv, &rsip->out_handle))
goto out; goto out;
if (resv->iov_len + 3 * 4 > PAGE_SIZE) if (resv->iov_len + 3 * 4 > PAGE_SIZE)
goto out; goto out;
svc_putnl(resv, rsip->major_status); svc_putnl(resv, rsip->major_status);
svc_putnl(resv, rsip->minor_status); svc_putnl(resv, rsip->minor_status);
svc_putnl(resv, GSS_SEQ_WIN); svc_putnl(resv, GSS_SEQ_WIN);
if (svc_safe_putnetobj(resv, &rsip->out_token)) if (svc_safe_putnetobj(resv, &rsip->out_token))
goto out; goto out;
}
ret = SVC_COMPLETE; ret = SVC_COMPLETE;
out: out:
cache_put(&rsip->h, &rsi_cache); cache_put(&rsip->h, &rsi_cache);