diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-03-14 22:07:14 +0400 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-03-14 22:07:14 +0400 |
commit | ab43ad2fd822504446e7876d6352c968a74beb53 (patch) | |
tree | f18b845bcfa83c72f4b4b3e1cedd0efb79f56691 /src/attr_file.c | |
parent | e3c475107045cb89c53c114716bafebc7538433f (diff) |
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.
Diffstat (limited to 'src/attr_file.c')
-rw-r--r-- | src/attr_file.c | 22 |
1 files changed, 11 insertions, 11 deletions
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; } |