From owner-svn-src-all@FreeBSD.ORG Tue Mar 31 19:12:14 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAF001F1; Tue, 31 Mar 2015 19:12:14 +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 7C650800; Tue, 31 Mar 2015 19:12:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2VJCEP5058645; Tue, 31 Mar 2015 19:12:14 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2VJCEpD058644; Tue, 31 Mar 2015 19:12:14 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201503311912.t2VJCEpD058644@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 31 Mar 2015 19:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280914 - head/sbin/md5 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-1 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: Tue, 31 Mar 2015 19:12:14 -0000 Author: delphij Date: Tue Mar 31 19:12:13 2015 New Revision: 280914 URL: https://svnweb.freebsd.org/changeset/base/280914 Log: Constify. Suggested by: rdivacky MFC after: 2 weeks Modified: head/sbin/md5/md5.c Modified: head/sbin/md5/md5.c ============================================================================== --- head/sbin/md5/md5.c Tue Mar 31 19:07:28 2015 (r280913) +++ head/sbin/md5/md5.c Tue Mar 31 19:12:13 2015 (r280914) @@ -70,11 +70,11 @@ typedef struct Algorithm_t { } Algorithm_t; static void MD5_Update(MD5_CTX *, const unsigned char *, size_t); -static void MDString(Algorithm_t *, const char *); -static void MDTimeTrial(Algorithm_t *); -static void MDTestSuite(Algorithm_t *); -static void MDFilter(Algorithm_t *, int); -static void usage(Algorithm_t *); +static void MDString(const Algorithm_t *, const char *); +static void MDTimeTrial(const Algorithm_t *); +static void MDTestSuite(const Algorithm_t *); +static void MDFilter(const Algorithm_t *, int); +static void usage(const Algorithm_t *); typedef union { MD5_CTX md5; @@ -91,7 +91,7 @@ typedef union { /* algorithm function table */ -static struct Algorithm_t Algorithm[] = { +static const struct Algorithm_t Algorithm[] = { { "md5", "MD5", &MD5TestOutput, (DIGEST_Init*)&MD5Init, (DIGEST_Update*)&MD5_Update, (DIGEST_End*)&MD5End, &MD5Data, &MD5File }, @@ -216,7 +216,7 @@ main(int argc, char *argv[]) * Digests a string and prints the result. */ static void -MDString(Algorithm_t *alg, const char *string) +MDString(const Algorithm_t *alg, const char *string) { size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; @@ -240,7 +240,7 @@ MDString(Algorithm_t *alg, const char *s * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. */ static void -MDTimeTrial(Algorithm_t *alg) +MDTimeTrial(const Algorithm_t *alg) { DIGEST_CTX context; struct rusage before, after; @@ -350,7 +350,7 @@ const char *RIPEMD160_TestOutput[MDTESTC }; static void -MDTestSuite(Algorithm_t *alg) +MDTestSuite(const Algorithm_t *alg) { int i; char buffer[HEX_DIGEST_LENGTH]; @@ -370,7 +370,7 @@ MDTestSuite(Algorithm_t *alg) * Digests the standard input and prints the result. */ static void -MDFilter(Algorithm_t *alg, int tee) +MDFilter(const Algorithm_t *alg, int tee) { DIGEST_CTX context; unsigned int len; @@ -387,7 +387,7 @@ MDFilter(Algorithm_t *alg, int tee) } static void -usage(Algorithm_t *alg) +usage(const Algorithm_t *alg) { fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname);