Improved callback/states support to make libxbps std{err,out} printf free.

This is a major API/ABI change, documentation has been updated accordingly.
This commit is contained in:
Juan RP
2011-11-24 11:23:08 +01:00
parent 4ed6b5ed2c
commit 3ccfec7054
29 changed files with 910 additions and 726 deletions

View File

@@ -203,12 +203,6 @@ xbps_end(struct xbps_handle *xh)
prop_object_release(xh->cachedir);
if (prop_object_type(xh->virtualpkgs_array) == PROP_TYPE_ARRAY)
prop_object_release(xh->virtualpkgs_array);
if (xh->xfcd != NULL)
free(xh->xfcd);
if (xh->xucd != NULL)
free(xh->xucd);
if (xh->xscd != NULL)
free(xh->xscd);
free(xh);
xh = NULL;
@@ -225,31 +219,7 @@ xbps_handle_get(void)
struct xbps_handle *
xbps_handle_alloc(void)
{
struct xbps_handle *xh;
xh = malloc(sizeof *xh);
if (xh == NULL)
return NULL;
xh->xscd = malloc(sizeof *xh->xscd);
if (xh->xscd == NULL) {
free(xh);
return NULL;
}
xh->xucd = malloc(sizeof *xh->xucd);
if (xh->xucd == NULL) {
free(xh->xscd);
free(xh);
return NULL;
}
xh->xfcd = malloc(sizeof *xh->xfcd);
if (xh->xfcd == NULL) {
free(xh->xucd);
free(xh->xscd);
free(xh);
return NULL;
}
return xh;
return malloc(sizeof(struct xbps_handle));
}
static void
@@ -306,13 +276,3 @@ xbps_warn_printf(const char *fmt, ...)
common_printf(stderr, "WARNING: ", fmt, ap);
va_end(ap);
}
void
xbps_printf(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
common_printf(stdout, NULL, fmt, ap);
va_end(ap);
}