#include <pakfire/i18n.h>
#include <pakfire/pakfire.h>
#include <pakfire/progress.h>
+#include <pakfire/util.h>
#include "progressbar.h"
#include "terminal.h"
static ssize_t cli_progressbar_bar(struct cli_progressbar* p,
struct cli_progressbar_widget* widget, unsigned int width, void* data) {
// Allocate or adjust the buffer
- widget->buffer = realloc(widget->buffer, width + 1);
+ widget->buffer = pakfire_realloc(widget->buffer, width + 1);
// Fail if we could not allocate the buffer
if (!widget->buffer)
#include <time.h>
#include <pakfire/string.h>
+#include <pakfire/util.h>
int __pakfire_string_format(char* s, const size_t length, const char* format, ...) {
va_list args;
size_t length = (buffer && *buffer) ? strlen(*buffer) : 0;
// Resize the buffer
- *buffer = realloc(*buffer, length + l + 1);
+ *buffer = pakfire_realloc(*buffer, length + l + 1);
if (!*buffer)
return -errno;
static int pakfire_xfer_allocate(struct pakfire_xfer* xfer, size_t size) {
// Otherwise, we resize the buffer
- xfer->buffer.data = realloc(xfer->buffer.data, size);
+ xfer->buffer.data = pakfire_realloc(xfer->buffer.data, size);
if (!xfer->buffer.data) {
CTX_ERROR(xfer->ctx, "Could not allocate memory: %m\n");