Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2014 23:34:14 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265202 - head/lib/libc/regex
Message-ID:  <201405012334.s41NYENs010235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu May  1 23:34:14 2014
New Revision: 265202
URL: http://svnweb.freebsd.org/changeset/base/265202

Log:
  regex: Remove some unreachable breaks.
  
  This is based on a much bigger cleanup done in Illumos.
  
  Reference:
  https://www.illumos.org/issues/2077
  
  MFC after:	1 week

Modified:
  head/lib/libc/regex/engine.c
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/engine.c
==============================================================================
--- head/lib/libc/regex/engine.c	Thu May  1 22:28:14 2014	(r265201)
+++ head/lib/libc/regex/engine.c	Thu May  1 23:34:14 2014	(r265202)
@@ -686,19 +686,16 @@ backref(struct match *m,
 		while (m->g->strip[ss] != SOP(O_BACK, i))
 			ss++;
 		return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
-		break;
 	case OQUEST_:		/* to null or not */
 		dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
 		if (dp != NULL)
 			return(dp);	/* not */
 		return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
-		break;
 	case OPLUS_:
 		assert(m->lastpos != NULL);
 		assert(lev+1 <= m->g->nplus);
 		m->lastpos[lev+1] = sp;
 		return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
-		break;
 	case O_PLUS:
 		if (sp == m->lastpos[lev])	/* last pass matched null */
 			return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
@@ -709,7 +706,6 @@ backref(struct match *m,
 			return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
 		else
 			return(dp);
-		break;
 	case OCH_:		/* find the right one, if any */
 		ssub = ss + 1;
 		esub = ss + OPND(s) - 1;
@@ -730,6 +726,7 @@ backref(struct match *m,
 			else
 				assert(OP(m->g->strip[esub]) == O_CH);
 		}
+		/* NOTREACHED */
 		break;
 	case OLPAREN:		/* must undo assignment if rest fails */
 		i = OPND(s);
@@ -741,7 +738,6 @@ backref(struct match *m,
 			return(dp);
 		m->pmatch[i].rm_so = offsave;
 		return(NULL);
-		break;
 	case ORPAREN:		/* must undo assignment if rest fails */
 		i = OPND(s);
 		assert(0 < i && i <= m->g->nsub);
@@ -752,7 +748,6 @@ backref(struct match *m,
 			return(dp);
 		m->pmatch[i].rm_eo = offsave;
 		return(NULL);
-		break;
 	default:		/* uh oh */
 		assert(nope);
 		break;

Modified: head/lib/libc/regex/regcomp.c
==============================================================================
--- head/lib/libc/regex/regcomp.c	Thu May  1 22:28:14 2014	(r265201)
+++ head/lib/libc/regex/regcomp.c	Thu May  1 23:34:14 2014	(r265202)
@@ -746,7 +746,6 @@ p_b_term(struct parse *p, cset *cs)
 	case '-':
 		SETERROR(REG_ERANGE);
 		return;			/* NOTE RETURN */
-		break;
 	default:
 		c = '\0';
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405012334.s41NYENs010235>