From owner-svn-src-projects@freebsd.org Sun Aug 9 00:19:15 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94DB39B7BE1 for ; Sun, 9 Aug 2015 00:19:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C776F5A; Sun, 9 Aug 2015 00:19:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t790JFNg035992; Sun, 9 Aug 2015 00:19:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t790JEkv035990; Sun, 9 Aug 2015 00:19:14 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508090019.t790JEkv035990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 9 Aug 2015 00:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r286493 - projects/collation/lib/libc/string X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 00:19:15 -0000 Author: bapt Date: Sun Aug 9 00:19:14 2015 New Revision: 286493 URL: https://svnweb.freebsd.org/changeset/base/286493 Log: Fix typo Remove useless tests before free() Suggested by: jilles Modified: projects/collation/lib/libc/string/strcoll.c projects/collation/lib/libc/string/strxfrm.c Modified: projects/collation/lib/libc/string/strcoll.c ============================================================================== --- projects/collation/lib/libc/string/strcoll.c Sun Aug 9 00:15:17 2015 (r286492) +++ projects/collation/lib/libc/string/strcoll.c Sun Aug 9 00:19:14 2015 (r286493) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); /* - * In order to properly handle multibyte locales, its easiet to just + * In order to properly handle multibyte locales, its easiest to just * convert to wide characters and then use wcscoll. However if an * error occurs, we gracefully fall back to simple strcmp. Caller * should check errno. @@ -99,18 +99,14 @@ strcoll_l(const char *s, const char *s2, goto error; ret = wcscoll_l(w1, w2, locale); - if (t1) - free(t1); - if (t2) - free(t2); + free(t1); + free(t2); return (ret); error: - if (t1) - free(t1); - if (t2) - free(t2); + free(t1); + free(t2); return (strcmp(s, s2)); } Modified: projects/collation/lib/libc/string/strxfrm.c ============================================================================== --- projects/collation/lib/libc/string/strxfrm.c Sun Aug 9 00:15:17 2015 (r286492) +++ projects/collation/lib/libc/string/strxfrm.c Sun Aug 9 00:19:14 2015 (r286493) @@ -84,8 +84,7 @@ strxfrm_l(char * __restrict dest, const if ((xlen = _collate_sxfrm(table, wcs, dest, len)) == (size_t)-1) goto error; - if (wcs) - free(wcs); + free(wcs); if (len > xlen) { dest[xlen] = 0; @@ -97,9 +96,8 @@ strxfrm_l(char * __restrict dest, const error: /* errno should be set to ENOMEM if malloc failed */ - if (wcs) - free(wcs); - (void) strlcpy(dest, src, len); + free(wcs); + strlcpy(dest, src, len); return (slen); }