To let users of yajl writing code that is cleaner, a set of callback
function types is introduced by this patch.
Old (before this patch) way of using callbacks:
// Callback definition
static int my_parse_null(void *raw_ctx)
{
ProjectSpecificType *ctx = (ProjectSpecificType *) raw_ctx;
// the code that is using ctx follows...
}
// ...
// Setting the callback
yajl_callbacks cb;
cb.yajl_null = my_parse_null;
New (with this patch applied) way of using callbacks
// Callback definition
static int my_parse_null(ProjectSpecificType *ctx)
{
// the code that is using ctx follows...
}
// ...
// Setting the callback
yajl_callbacks cb;
cb.yajl_null = (yajl_null_t) my_parse_null;
Both (the old and the new) ways of using callbacks are supported with no
changes to the existing code needed.
To let users of yajl writing code that is cleaner, a set of callback function types is introduced by this patch.
Old (before this patch) way of using callbacks:
New (with this patch applied) way of using callbacks
Both (the old and the new) ways of using callbacks are supported with no changes to the existing code needed.
Signed-off-by: Serge Broslavsky serge.broslavsky@linaro.org