Module Name: src Committed By: abhinav Date: Mon May 1 06:43:56 UTC 2017
Modified Files: src/usr.sbin/makemandb: makemandb.c Log Message: Remove the table name parameter from the check_md5 function. There is only one table storing the md5 checksums, so we can hardcode the table name instead of passing it as a function argument. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/makemandb/makemandb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makemandb/makemandb.c diff -u src/usr.sbin/makemandb/makemandb.c:1.51 src/usr.sbin/makemandb/makemandb.c:1.52 --- src/usr.sbin/makemandb/makemandb.c:1.51 Mon May 1 05:52:33 2017 +++ src/usr.sbin/makemandb/makemandb.c Mon May 1 06:43:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.51 2017/05/01 05:52:33 abhinav Exp $ */ +/* $NetBSD: makemandb.c,v 1.52 2017/05/01 06:43:56 abhinav Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: makemandb.c,v 1.51 2017/05/01 05:52:33 abhinav Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.52 2017/05/01 06:43:56 abhinav Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -96,7 +96,7 @@ typedef void (*proff_nf)(const struct ro static void append(secbuff *sbuff, const char *src); static void init_secbuffs(mandb_rec *); static void free_secbuffs(mandb_rec *); -static int check_md5(const char *, sqlite3 *, const char *, char **, void *, size_t); +static int check_md5(const char *, sqlite3 *, char **, void *, size_t); static void cleanup(mandb_rec *); static void set_section(const struct roff_man *, mandb_rec *); static void set_machine(const struct roff_man *, mandb_rec *); @@ -804,8 +804,7 @@ update_db(sqlite3 *db, struct mparse *mp err_count++; continue; } - md5_status = check_md5(file, db, "mandb_meta", &md5sum, buf, - buflen); + md5_status = check_md5(file, db, &md5sum, buf, buflen); assert(md5sum != NULL); if (md5_status == -1) { if (mflags.verbosity) @@ -1822,7 +1821,7 @@ insert_into_db(sqlite3 *db, mandb_rec *r /* * check_md5-- * Generates the md5 hash of the file and checks if it already doesn't exist - * in the table (passed as the 3rd parameter). + * in the table. * This function is being used to avoid hardlinks. * On successful completion it will also set the value of the fourth parameter * to the md5 hash of the file (computed previously). It is the responsibility @@ -1833,8 +1832,7 @@ insert_into_db(sqlite3 *db, mandb_rec *r * 1: If the hash exists in the database. */ static int -check_md5(const char *file, sqlite3 *db, const char *table, char **md5sum, - void *buf, size_t buflen) +check_md5(const char *file, sqlite3 *db, char **md5sum, void *buf, size_t buflen) { int rc = 0; int idx = -1; @@ -1849,8 +1847,7 @@ check_md5(const char *file, sqlite3 *db, return -1; } - easprintf(&sqlstr, "SELECT * FROM %s WHERE md5_hash = :md5_hash", - table); + easprintf(&sqlstr, "SELECT * FROM mandb_meta WHERE md5_hash = :md5_hash"); rc = sqlite3_prepare_v2(db, sqlstr, -1, &stmt, NULL); if (rc != SQLITE_OK) { free(sqlstr);