summaryrefslogtreecommitdiff
path: root/src/input/filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/filter.c')
-rw-r--r--src/input/filter.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/input/filter.c b/src/input/filter.c
index b24ab56..f2d2c20 100644
--- a/src/input/filter.c
+++ b/src/input/filter.c
@@ -39,9 +39,6 @@ struct parserutils_filter {
struct {
uint16_t encoding; /**< Input encoding */
} settings; /**< Filter settings */
-
- parserutils_alloc alloc; /**< Memory (de)allocation function */
- void *pw; /**< Client private data */
};
static parserutils_error filter_set_defaults(parserutils_filter *input);
@@ -52,8 +49,6 @@ static parserutils_error filter_set_encoding(parserutils_filter *input,
* Create an input filter
*
* \param int_enc Desired encoding of document
- * \param alloc Function used to (de)allocate data
- * \param pw Pointer to client-specific private data (may be NULL)
* \param filter Pointer to location to receive filter instance
* \return PARSERUTILS_OK on success,
* PARSERUTILS_BADPARM on bad parameters,
@@ -61,15 +56,15 @@ static parserutils_error filter_set_encoding(parserutils_filter *input,
* PARSERUTILS_BADENCODING if the encoding is unsupported
*/
parserutils_error parserutils__filter_create(const char *int_enc,
- parserutils_alloc alloc, void *pw, parserutils_filter **filter)
+ parserutils_filter **filter)
{
parserutils_filter *f;
parserutils_error error;
- if (int_enc == NULL || alloc == NULL || filter == NULL)
+ if (int_enc == NULL || filter == NULL)
return PARSERUTILS_BADPARM;
- f = alloc(NULL, sizeof(parserutils_filter), pw);
+ f = malloc(sizeof(parserutils_filter));
if (f == NULL)
return PARSERUTILS_NOMEM;
@@ -78,7 +73,7 @@ parserutils_error parserutils__filter_create(const char *int_enc,
f->int_enc = parserutils_charset_mibenum_from_name(
int_enc, strlen(int_enc));
if (f->int_enc == 0) {
- alloc(f, 0, pw);
+ free(f);
return PARSERUTILS_BADENCODING;
}
#else
@@ -87,12 +82,9 @@ parserutils_error parserutils__filter_create(const char *int_enc,
f->pivot_len = 0;
#endif
- f->alloc = alloc;
- f->pw = pw;
-
error = filter_set_defaults(f);
if (error != PARSERUTILS_OK) {
- f->alloc(f, 0, pw);
+ free(f);
return error;
}
@@ -104,7 +96,7 @@ parserutils_error parserutils__filter_create(const char *int_enc,
parserutils_charset_codec_destroy(f->read_codec);
f->read_codec = NULL;
}
- f->alloc(f, 0, pw);
+ free(f);
return error;
}
#endif
@@ -142,7 +134,7 @@ parserutils_error parserutils__filter_destroy(parserutils_filter *input)
}
#endif
- input->alloc(input, 0, input->pw);
+ free(input);
return PARSERUTILS_OK;
}
@@ -405,8 +397,7 @@ parserutils_error filter_set_encoding(parserutils_filter *input,
input->read_codec = NULL;
}
- error = parserutils_charset_codec_create(enc, input->alloc,
- input->pw, &input->read_codec);
+ error = parserutils_charset_codec_create(enc, &input->read_codec);
if (error != PARSERUTILS_OK)
return error;
#endif