pkgtools

morpheus pkg tools
git clone git://git.2f30.org/pkgtools
Log | Files | Refs | README | LICENSE

commit 299886a34bad4edbf40039b916b265ec679524d4
parent a0874e30ffa484415727d0b84bd1bcbac22e4eca
Author: sin <sin@2f30.org>
Date:   Wed,  2 Jul 2014 01:10:32 +0100

Style fixes

Diffstat:
Mreject.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/reject.c b/reject.c @@ -1,7 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "pkg.h" -/* Release pre-computed regexes */ void rej_free(struct db *db) { @@ -33,8 +32,9 @@ rej_load(struct db *db) return -1; while ((len = getline(&buf, &sz, fp)) != -1) { + /* skip empty lines and comments. */ if (!len || buf[0] == '#' || buf[0] == '\n') - continue; /* skip empty lines and comments. */ + continue; if (len > 0 && buf[len - 1] == '\n') buf[len - 1] = '\0'; @@ -53,19 +53,22 @@ rej_load(struct db *db) TAILQ_INSERT_TAIL(&db->rejrule_head, rule, entry); } - free(buf); + if (ferror(fp)) { weprintf("%s: read error:", rejpath); + free(buf); fclose(fp); rej_free(db); return -1; } + + free(buf); fclose(fp); return 0; } -/* Match pre-computed regexes against the given file */ +/* Match pre-computed regexes against the file */ int rej_match(struct db *db, const char *file) {