From 0631d37606ce4e88c7de1912cb71a57e656977e4 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@dkrz.de>
Date: Thu, 7 Apr 2016 08:20:52 +0000
Subject: [PATCH] Reduce control flow variation.

---
 src/stream_cgribex.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/stream_cgribex.c b/src/stream_cgribex.c
index 924b9dea2..a70c370f8 100644
--- a/src/stream_cgribex.c
+++ b/src/stream_cgribex.c
@@ -1702,10 +1702,7 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
 	    else
 	      {
 		xfirst = gridInqXval(gridID,      0);
-		if ( lcurvi )
-		  xlast  = gridInqXval(gridID, nlon*nlat-1);
-		else
-		  xlast  = gridInqXval(gridID, nlon-1);
+                xlast  = gridInqXval(gridID, (lcurvi ? nlon*nlat : nlon) - 1);
 		xinc   = gridInqXinc(gridID);
 	      }
 	  }
@@ -1717,10 +1714,7 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
 	else
 	  {
 	    yfirst = gridInqYval(gridID,      0);
-	    if ( lcurvi )
-	      ylast  = gridInqYval(gridID, nlon*nlat-1);
-	    else
-	      ylast  = gridInqYval(gridID, nlat-1);
+            ylast  = gridInqYval(gridID, (lcurvi ? nlon*nlat : nlat) - 1);
 	    yinc   = gridInqYinc(gridID);
 	    if ( yinc < 0 ) yinc = -yinc;
 	  }
-- 
GitLab