From ab43ad2fd822504446e7876d6352c968a74beb53 Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Wed, 14 Mar 2012 11:07:14 -0700 Subject: Convert attr and other files to new errors This continues to add other files to the new error handling style. I think the only real concerns here are that there are a couple of error return cases that I have converted to asserts, but I think that it was the correct thing to do given the new error style. --- src/attr_file.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/attr_file.c') diff --git a/src/attr_file.c b/src/attr_file.c index 029934317..35679ef22 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -180,37 +180,37 @@ int git_attr_file__lookup_one( } } - return GIT_SUCCESS; + return 0; } -int git_attr_fnmatch__match( +bool git_attr_fnmatch__match( git_attr_fnmatch *match, const git_attr_path *path) { - int matched = FNM_NOMATCH; + int fnm; if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY && !path->is_dir) - return matched; + return false; if (match->flags & GIT_ATTR_FNMATCH_FULLPATH) - matched = p_fnmatch(match->pattern, path->path, FNM_PATHNAME); + fnm = p_fnmatch(match->pattern, path->path, FNM_PATHNAME); else if (path->is_dir) - matched = p_fnmatch(match->pattern, path->basename, FNM_LEADING_DIR); + fnm = p_fnmatch(match->pattern, path->basename, FNM_LEADING_DIR); else - matched = p_fnmatch(match->pattern, path->basename, 0); + fnm = p_fnmatch(match->pattern, path->basename, 0); - return matched; + return (fnm == FNM_NOMATCH) ? false : true; } -int git_attr_rule__match( +bool git_attr_rule__match( git_attr_rule *rule, const git_attr_path *path) { - int matched = git_attr_fnmatch__match(&rule->match, path); + bool matched = git_attr_fnmatch__match(&rule->match, path); if (rule->match.flags & GIT_ATTR_FNMATCH_NEGATIVE) - matched = (matched == GIT_SUCCESS) ? FNM_NOMATCH : GIT_SUCCESS; + matched = !matched; return matched; } -- cgit v1.2.3