summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/block_processor.c')
-rw-r--r--lib/sqfs/block_processor.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/sqfs/block_processor.c b/lib/sqfs/block_processor.c
index 3a57d14..649e97f 100644
--- a/lib/sqfs/block_processor.c
+++ b/lib/sqfs/block_processor.c
@@ -8,11 +8,11 @@
#include "config.h"
#include "sqfs/block_processor.h"
+#include "sqfs/error.h"
#include "util.h"
#include <string.h>
#include <stdlib.h>
-#include <stdio.h>
struct sqfs_block_processor_t {
size_t max_block_size;
@@ -35,10 +35,8 @@ sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
proc = alloc_flex(sizeof(*proc), 1, max_block_size);
- if (proc == NULL) {
- perror("Creating block processor");
+ if (proc == NULL)
return NULL;
- }
proc->max_block_size = max_block_size;
proc->cmp = cmp;
@@ -55,19 +53,23 @@ void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
sqfs_block_t *block)
{
- if (sqfs_block_process(block, proc->cmp,
- proc->scratch, proc->max_block_size))
+ int ret;
+
+ ret = sqfs_block_process(block, proc->cmp,
+ proc->scratch, proc->max_block_size);
+ if (ret)
goto fail;
- if (proc->cb(proc->user, block))
+ ret = proc->cb(proc->user, block);
+ if (ret)
goto fail;
free(block);
return 0;
fail:
free(block);
- proc->status = -1;
- return -1;
+ proc->status = ret;
+ return ret;
}
int sqfs_block_processor_finish(sqfs_block_processor_t *proc)