Skip to content

Commit

Permalink
Constify.
Browse files Browse the repository at this point in the history
Suggested by:	rdivacky
MFC after:	2 weeks
  • Loading branch information
delphij committed Mar 31, 2015
1 parent f734628 commit a2f9ce8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions sbin/md5/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 },
Expand Down Expand Up @@ -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];
Expand All @@ -240,7 +240,7 @@ MDString(Algorithm_t *alg, const char *string)
* 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;
Expand Down Expand Up @@ -350,7 +350,7 @@ const char *RIPEMD160_TestOutput[MDTESTCOUNT] = {
};

static void
MDTestSuite(Algorithm_t *alg)
MDTestSuite(const Algorithm_t *alg)
{
int i;
char buffer[HEX_DIGEST_LENGTH];
Expand All @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit a2f9ce8

Please sign in to comment.