mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
refactor: remove unnecessary local variables
This commit is contained in:
parent
cfa5268af2
commit
20ca75639d
48 changed files with 446 additions and 237 deletions
|
@ -25,20 +25,27 @@ dynamic getAttribute({
|
|||
calloc.free(nameC);
|
||||
|
||||
if (error < 0) {
|
||||
calloc.free(out);
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
|
||||
final attributeValue = libgit2.git_attr_value(out.value);
|
||||
|
||||
if (attributeValue == git_attr_value_t.GIT_ATTR_VALUE_UNSPECIFIED) {
|
||||
calloc.free(out);
|
||||
return null;
|
||||
} else if (attributeValue == git_attr_value_t.GIT_ATTR_VALUE_TRUE) {
|
||||
calloc.free(out);
|
||||
return true;
|
||||
} else if (attributeValue == git_attr_value_t.GIT_ATTR_VALUE_FALSE) {
|
||||
calloc.free(out);
|
||||
return false;
|
||||
} else if (attributeValue == git_attr_value_t.GIT_ATTR_VALUE_STRING) {
|
||||
return out.value.cast<Utf8>().toDartString();
|
||||
final result = out.value.cast<Utf8>().toDartString();
|
||||
calloc.free(out);
|
||||
return result;
|
||||
} else {
|
||||
calloc.free(out);
|
||||
throw Exception('The attribute value from libgit2 is invalid');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue