lib/depends.c: simplify store_dependency().

--HG--
extra : convert_revision : 83d806e199b0cc593a82a7f0d575994ea04277fd
This commit is contained in:
Juan RP 2009-04-06 11:40:55 +02:00
parent 3fca3406eb
commit ebf400f728

View file

@ -94,9 +94,8 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
prop_array_t array, rundeps_array; prop_array_t array, rundeps_array;
size_t dirdepscnt = 0, indirdepscnt = 0; size_t dirdepscnt = 0, indirdepscnt = 0;
const char *pkgname, *version, *reqbyname, *arch; const char *pkgname, *version, *reqbyname, *arch;
const char *repoloc, *binfile, *originpkg, *short_desc; const char *repoloc, *binfile, *originpkg;
const char *sha256; const char *short_desc, *sha256;
int rv = 0;
bool indirectdep = false; bool indirectdep = false;
assert(origind != NULL); assert(origind != NULL);
@ -138,15 +137,13 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
* Create package dep's dictionary and array. * Create package dep's dictionary and array.
*/ */
dict = prop_dictionary_create(); dict = prop_dictionary_create();
if (dict == NULL) { if (dict == NULL)
rv = ENOMEM; return errno;
goto out;
}
array = prop_dictionary_get(chaindeps, "unsorted_deps"); array = prop_dictionary_get(chaindeps, "unsorted_deps");
if (array == NULL) { if (array == NULL) {
prop_object_release(dict); prop_object_release(dict);
rv = ENOENT; return errno;
goto out;
} }
/* /*
@ -170,11 +167,10 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
*/ */
if (!xbps_add_obj_to_array(array, dict)) { if (!xbps_add_obj_to_array(array, dict)) {
prop_object_release(dict); prop_object_release(dict);
rv = EINVAL; return EINVAL;
} }
out: return 0;
return rv;
} }
static int static int