From owner-svn-src-all@FreeBSD.ORG Sat Jun 14 01:58:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A142A00; Sat, 14 Jun 2014 01:58:34 +0000 (UTC) Received: from svn.freebsd.org (svn.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 776AC2D04; Sat, 14 Jun 2014 01:58:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5E1wXH2057831; Sat, 14 Jun 2014 01:58:33 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5E1wXYx057830; Sat, 14 Jun 2014 01:58:33 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201406140158.s5E1wXYx057830@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 14 Jun 2014 01:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267464 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jun 2014 01:58:34 -0000 Author: pfg Date: Sat Jun 14 01:58:33 2014 New Revision: 267464 URL: http://svnweb.freebsd.org/changeset/base/267464 Log: patch: cleanup some unnecessary cruft. - Drop some bogus casts to size_t. - The new_p_foo variables are not needed after r267426. Pointed out by: bde MFC after: 1 week Modified: head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/pch.c ============================================================================== --- head/usr.bin/patch/pch.c Sat Jun 14 01:32:48 2014 (r267463) +++ head/usr.bin/patch/pch.c Sat Jun 14 01:58:33 2014 (r267464) @@ -132,11 +132,11 @@ void set_hunkmax(void) { if (p_line == NULL) - p_line = malloc((size_t) hunkmax * sizeof(char *)); + p_line = malloc(hunkmax * sizeof(char *)); if (p_len == NULL) - p_len = malloc((size_t) hunkmax * sizeof(short)); + p_len = malloc(hunkmax * sizeof(short)); if (p_char == NULL) - p_char = malloc((size_t) hunkmax * sizeof(char)); + p_char = malloc(hunkmax * sizeof(char)); } /* @@ -145,23 +145,14 @@ set_hunkmax(void) static void grow_hunkmax(void) { - int new_hunkmax; - char **new_p_line; - short *new_p_len; - char *new_p_char; - - new_hunkmax = hunkmax * 2; + int new_hunkmax = hunkmax * 2; if (p_line == NULL || p_len == NULL || p_char == NULL) fatal("Internal memory allocation error\n"); - new_p_line = reallocf(p_line, new_hunkmax * sizeof(char *)); - new_p_len = reallocf(p_len, new_hunkmax * sizeof(short)); - new_p_char = reallocf(p_char, new_hunkmax * sizeof(char)); - - p_char = new_p_char; - p_len = new_p_len; - p_line = new_p_line; + p_line = reallocf(p_line, new_hunkmax * sizeof(char *)); + p_len = reallocf(p_len, new_hunkmax * sizeof(short)); + p_char = reallocf(p_char, new_hunkmax * sizeof(char)); if (p_line != NULL && p_len != NULL && p_char != NULL) { hunkmax = new_hunkmax;