summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/pkghash.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/pkghash.c')
-rw-r--r--lib/libalpm/pkghash.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/libalpm/pkghash.c b/lib/libalpm/pkghash.c
index f4153300..9e98fcd8 100644
--- a/lib/libalpm/pkghash.c
+++ b/lib/libalpm/pkghash.c
@@ -17,9 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
+
#include "pkghash.h"
#include "util.h"
-#include "log.h"
/* List of primes for possible sizes of hash tables.
*
@@ -55,11 +56,7 @@ pmpkghash_t *_alpm_pkghash_create(size_t size)
pmpkghash_t *hash = NULL;
size_t i, loopsize;
- MALLOC(hash, sizeof(pmpkghash_t), RET_ERR(PM_ERR_MEMORY, NULL));
-
- hash->list = NULL;
- hash->entries = 0;
- hash->buckets = 0;
+ CALLOC(hash, 1, sizeof(pmpkghash_t), return NULL);
loopsize = sizeof(prime_list) / sizeof(*prime_list);
for(i = 0; i < loopsize; i++) {
@@ -70,13 +67,13 @@ pmpkghash_t *_alpm_pkghash_create(size_t size)
}
if(hash->buckets < size) {
- _alpm_log(PM_LOG_ERROR, _("database larger than maximum size\n"));
+ errno = ERANGE;
free(hash);
return NULL;
}
CALLOC(hash->hash_table, hash->buckets, sizeof(alpm_list_t *), \
- free(hash); RET_ERR(PM_ERR_MEMORY, NULL));
+ free(hash); return NULL);
return hash;
}
@@ -304,8 +301,6 @@ pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name)
unsigned long name_hash;
size_t position;
- ALPM_LOG_FUNC;
-
if(name == NULL || hash == NULL) {
return NULL;
}