Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-14 22:07:14 +0400
committerRussell Belfer <arrbee@arrbee.com>2012-03-14 22:07:14 +0400
commitab43ad2fd822504446e7876d6352c968a74beb53 (patch)
treef18b845bcfa83c72f4b4b3e1cedd0efb79f56691 /src/attr_file.c
parente3c475107045cb89c53c114716bafebc7538433f (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.c22
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;
}