There is no point in using an own function to free any memory.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
int ret = pakfire_archive_read(self->archive, filename, &data, &data_size, flags);
if (ret) {
- pakfire_free(data);
+ free(data);
Py_RETURN_NONE;
}
// XXX This is not ideal since PyBytes_FromStringAndSize creates a
// copy of data.
PyObject* bytes = PyBytes_FromStringAndSize(data, data_size);
- pakfire_free(data);
+ free(data);
return bytes;
}
// Extract payload
int r = pakfire_archive_extract(self->archive, prefix, PAKFIRE_ARCHIVE_USE_PAYLOAD);
- pakfire_free(prefix);
+ free(prefix);
// Throw an exception on error
if (r) {
Py_RETURN_NONE;
PyObject* ret = PyUnicode_FromString(value);
- pakfire_free(value);
+ free(value);
return ret;
}
char* string = pakfire_key_dump(self->key);
PyObject* object = PyUnicode_FromString(string);
- pakfire_free(string);
+ free(string);
return object;
}
char* export = pakfire_key_export(self->key, mode);
PyObject* object = PyUnicode_FromFormat("%s", export);
- pakfire_free(export);
+ free(export);
return object;
}
PyObject* repr = PyUnicode_FromFormat("<_pakfire.Package object id %ld, %s>",
Package_hash(self), nevra);
- pakfire_free(nevra);
+ free(nevra);
return repr;
}
char* nevra = pakfire_package_get_nevra(self->package);
PyObject* str = PyUnicode_FromString(nevra);
- pakfire_free(nevra);
+ free(nevra);
return str;
}
while ((group = *groups++) != NULL) {
PyObject* item = PyUnicode_FromString(group);
PyList_Append(list, item);
- pakfire_free(group);
+ free(group);
Py_DECREF(item);
}
- pakfire_free(groups);
+ free(groups);
return list;
}
static PyObject* Package_get_cache_path(PackageObject* self) {
char* cache_path = pakfire_package_get_cache_path(self->package);
PyObject* ret = PyUnicode_FromString(cache_path);
- pakfire_free(cache_path);
+ free(cache_path);
return ret;
}
char* location = pakfire_package_get_location(self->package);
PyObject* str = PyUnicode_FromString(location);
- pakfire_free(location);
+ free(location);
return str;
}
Py_RETURN_NONE;
PyObject* obj = PyUnicode_FromString(path);
- pakfire_free(path);
+ free(path);
return obj;
}
char* relation = pakfire_relation_str(self->relation);
PyObject* repr = PyUnicode_FromFormat("<_pakfire.Relation %s>", relation);
- pakfire_free(relation);
+ free(relation);
return repr;
}
char* relation = pakfire_relation_str(self->relation);
PyObject* str = PyUnicode_FromString(relation);
- pakfire_free(relation);
+ free(relation);
return str;
}
if (config) {
PyObject* obj = PyUnicode_FromString(config);
- pakfire_free(config);
+ free(config);
return obj;
}
char* cache_path = pakfire_repo_cache_get_path(self->repo, path);
PyObject* obj = PyUnicode_FromString(cache_path);
- pakfire_free(cache_path);
+ free(cache_path);
return obj;
}
pakfire_step_get_type_string(self->step), nevra);
pakfire_package_unref(package);
- pakfire_free(nevra);
+ free(nevra);
return repr;
}
break;
if (size < 0) {
- pakfire_free(*data);
+ free(*data);
*data = NULL;
return 1;
static int payload_archive_close(struct archive* a, void* client_data) {
struct payload_archive_data* data = client_data;
- pakfire_free(data);
+ free(data);
return ARCHIVE_OK;
}
DEBUG(c->pakfire, "Releasing archive checksum at %p\n", c);
pakfire_unref(c->pakfire);
- pakfire_free(c->filename);
- pakfire_free(c);
+ free(c->filename);
+ free(c);
}
static archive_checksum_t* pakfire_archive_checksum_create(Pakfire pakfire, const char* filename, archive_checksum_algo_t algo, const char* s) {
if (signature->key)
pakfire_key_unref(signature->key);
- pakfire_free(signature->sigdata);
- pakfire_free(signature);
+ free(signature->sigdata);
+ free(signature);
}
PAKFIRE_EXPORT PakfireArchiveSignature pakfire_archive_signature_ref(PakfireArchiveSignature signature) {
DEBUG(archive->pakfire, "Releasing archive at %p\n", archive);
if (archive->path)
- pakfire_free(archive->path);
+ free(archive->path);
// Free checksums
archive_checksum_t** checksums = archive->checksums;
while (signatures && *signatures)
pakfire_archive_signature_unref(*signatures++);
- pakfire_free(archive->signatures);
+ free(archive->signatures);
}
// Free scriptlets
pakfire_parser_unref(archive->parser);
pakfire_unref(archive->pakfire);
- pakfire_free(archive);
+ free(archive);
}
PAKFIRE_EXPORT PakfireArchive pakfire_archive_unref(PakfireArchive archive) {
// Parse metadata file
r = pakfire_parser_parse_data(archive->parser, (const char*)data, data_size);
- pakfire_free(data);
+ free(data);
return r;
}
r = pakfire_filelist_create_from_file(&archive->filelist, data, archive->format);
}
- pakfire_free(data);
+ free(data);
return r;
}
// Terminate the list
*checksums = NULL;
- pakfire_free(data);
+ free(data);
return 0;
}
archive_entry_set_pathname(entry, pathname);
DEBUG(pakfire, "Extracting %s (%zu bytes)\n", pathname, size);
- pakfire_free(pathname);
+ free(pathname);
// Update hardlink targets
const char* hardlink = archive_entry_hardlink(entry);
// Update the entry
archive_entry_set_hardlink(entry, h);
- pakfire_free(h);
+ free(h);
}
// Create file
// Cleanup
pakfire_package_unref(pkg);
pakfire_repo_unref(repo);
- pakfire_free(nevra);
+ free(nevra);
return prefix;
}
archive->pakfire, repo, name, evr, (arch) ? arch : "src"
);
- pakfire_free(name);
- pakfire_free(type);
- pakfire_free(e);
- pakfire_free(v);
- pakfire_free(r);
- pakfire_free(evr);
+ free(name);
+ free(type);
+ free(e);
+ free(v);
+ free(r);
+ free(evr);
if (arch)
- pakfire_free(arch);
+ free(arch);
#ifdef ENABLE_DEBUG
char* nevra = pakfire_package_get_nevra(pkg);
DEBUG(archive->pakfire, "Created package %s (%p) from archive %p\n",
nevra, pkg, archive);
- pakfire_free(nevra);
+ free(nevra);
#endif
// Set filename
char* filename = pakfire_basename(archive->path);
if (filename) {
pakfire_package_set_filename(pkg, filename);
- pakfire_free(filename);
+ free(filename);
}
// Set UUID
char* uuid = pakfire_archive_get(archive, "package.uuid");
if (uuid) {
pakfire_package_set_uuid(pkg, uuid);
- pakfire_free(uuid);
+ free(uuid);
}
// Set groups
char* groups = pakfire_archive_get(archive, "package.groups");
if (groups) {
pakfire_package_set_groups(pkg, groups);
- pakfire_free(groups);
+ free(groups);
}
// Set maintainer
char* maintainer = pakfire_archive_get(archive, "package.maintainer");
if (maintainer) {
pakfire_package_set_maintainer(pkg, maintainer);
- pakfire_free(maintainer);
+ free(maintainer);
}
// Set URL
char* url = pakfire_archive_get(archive, "package.url");
if (url) {
pakfire_package_set_url(pkg, url);
- pakfire_free(url);
+ free(url);
}
// Set license
char* license = pakfire_archive_get(archive, "package.license");
if (license) {
pakfire_package_set_license(pkg, license);
- pakfire_free(license);
+ free(license);
}
// Set summary
char* summary = pakfire_archive_get(archive, "package.summary");
if (summary) {
pakfire_package_set_summary(pkg, summary);
- pakfire_free(summary);
+ free(summary);
}
// Set description
char* description = pakfire_archive_get(archive, "package.description");
if (description) {
pakfire_package_set_description(pkg, description);
- pakfire_free(description);
+ free(description);
}
// Get package size
char* size = pakfire_archive_get(archive, "package.size");
if (size) {
size_t s = pakfire_string_to_size(size);
- pakfire_free(size);
+ free(size);
pakfire_package_set_installsize(pkg, s);
}
char* vendor = pakfire_archive_get(archive, "distribution.vendor");
if (vendor) {
pakfire_package_set_vendor(pkg, vendor);
- pakfire_free(vendor);
+ free(vendor);
}
// Set build host
char* buildhost = pakfire_archive_get(archive, "build.host");
if (buildhost) {
pakfire_package_set_buildhost(pkg, buildhost);
- pakfire_free(buildhost);
+ free(buildhost);
}
// Set build time
char* buildtime = pakfire_archive_get(archive, "build.time");
if (buildtime) {
unsigned long long t = strtoull(buildtime, NULL, 10);
- pakfire_free(buildtime);
+ free(buildtime);
pakfire_package_set_buildtime(pkg, t);
}
pakfire_unref(db->pakfire);
- pakfire_free(db);
+ free(db);
}
static sqlite3_value* pakfire_db_get(struct pakfire_db* db, const char* key) {
static void pakfire_file_free(PakfireFile file) {
if (file->name)
- pakfire_free(file->name);
+ free(file->name);
if (file->user)
- pakfire_free(file->user);
+ free(file->user);
if (file->group)
- pakfire_free(file->group);
+ free(file->group);
if (file->chksum)
- pakfire_free(file->chksum);
+ free(file->chksum);
- pakfire_free(file);
+ free(file);
}
PAKFIRE_EXPORT PakfireFile pakfire_file_ref(PakfireFile file) {
snprintf(str, len, "%s %-8s %-8s %8d %s %s", perms, user, group,
(int)size, mtime, name);
- pakfire_free(perms);
- pakfire_free(mtime);
+ free(perms);
+ free(mtime);
}
PAKFIRE_EXPORT const char* pakfire_file_get_name(PakfireFile file) {
PAKFIRE_EXPORT void pakfire_file_set_name(PakfireFile file, const char* name) {
if (file->name)
- pakfire_free(file->name);
+ free(file->name);
if (*name == '/') {
file->name = pakfire_strdup(name);
static void pakfire_filelist_free(PakfireFilelist list) {
pakfire_filelist_clear(list);
- pakfire_free(list);
+ free(list);
}
PAKFIRE_EXPORT PakfireFilelist pakfire_filelist_ref(PakfireFilelist list) {
# #
#############################################################################*/
+#include <stdlib.h>
+
#include <pakfire/filter.h>
#include <pakfire/private.h>
#include <pakfire/types.h>
}
PAKFIRE_EXPORT void pakfire_filter_free(PakfireFilter filter) {
- pakfire_free(filter->match);
- pakfire_free(filter);
+ free(filter->match);
+ free(filter);
}
void* pakfire_calloc(size_t num, size_t len);
void* pakfire_realloc(void* ptr, size_t size);
-void* pakfire_free(void* mem);
-
char* pakfire_strdup(const char* s);
int pakfire_string_startswith(const char* s, const char* prefix);
#include <assert.h>
#include <gpgme.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
// Setup engine
error = gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_OpenPGP, NULL, home);
- pakfire_free(home);
+ free(home);
if (gpg_err_code(error) != GPG_ERR_NO_ERROR)
goto FAIL;
pakfire_unref(key->pakfire);
gpgme_key_unref(key->gpgkey);
- pakfire_free(key);
+ free(key);
}
PAKFIRE_EXPORT PakfireKey pakfire_key_ref(PakfireKey key) {
pakfire_key_get_fingerprint(key),
date_created
);
- pakfire_free(date_created);
+ free(date_created);
const char* uid = pakfire_key_get_uid(key);
if (uid) {
if (expires) {
char* date_expires = pakfire_format_date(expires);
asprintf(&s, "%s\n %s: %s", s, _("Expires"), date_expires);
- pakfire_free(date_expires);
+ free(date_expires);
}
return s;
pakfire_access;
pakfire_basename;
pakfire_dirname;
- pakfire_free;
pakfire_get_errno;
pakfire_partition_string;
pakfire_path_isdir;
DEBUG(pkg->pakfire, "Releasing Package at %p\n", pkg);
pakfire_unref(pkg->pakfire);
- pakfire_free(pkg);
+ free(pkg);
}
PAKFIRE_EXPORT PakfirePackage pakfire_package_ref(PakfirePackage pkg) {
if (dep) {
pakfire_package_dump_add_line(str, (i == 0) ? key : "", dep);
- pakfire_free(dep);
+ free(dep);
}
}
}
if (val) {
pakfire_package_dump_add_line(str, key, val);
- pakfire_free(val);
+ free(val);
}
}
// Check if the file is readable
int r = pakfire_access(pkg->pakfire, path, NULL, R_OK);
- pakfire_free(path);
+ free(path);
return (r == 0);
}
// Open archive
PakfireArchive archive = pakfire_archive_open(pkg->pakfire, path);
- pakfire_free(path);
+ free(path);
return archive;
}
pakfire_package_unref(list->elements[i]);
}
- pakfire_free(list->elements);
- pakfire_free(list);
+ free(list->elements);
+ free(list);
}
PAKFIRE_EXPORT PakfirePackageList pakfire_packagelist_unref(PakfirePackageList list) {
return 0;
}
-// A utility function is already called pakfire_free
-static void _pakfire_free(Pakfire pakfire) {
+static void pakfire_free(Pakfire pakfire) {
DEBUG(pakfire, "Releasing Pakfire at %p\n", pakfire);
pakfire_repo_free_all(pakfire);
queue_free(&pakfire->installonly);
if (pakfire->arch)
- pakfire_free(pakfire->arch);
+ free(pakfire->arch);
if (pakfire->path)
- pakfire_free(pakfire->path);
+ free(pakfire->path);
if (pakfire->cache_path)
- pakfire_free(pakfire->cache_path);
+ free(pakfire->cache_path);
- pakfire_free(pakfire);
+ free(pakfire);
}
PAKFIRE_EXPORT int pakfire_create(Pakfire* pakfire, const char* path, const char* arch) {
private_dir, strerror(errno));
free(private_dir);
- _pakfire_free(p);
+ pakfire_free(p);
return r;
}
// Populate pool
r = pakfire_populate_pool(p);
if (r) {
- _pakfire_free(p);
+ pakfire_free(p);
return r;
}
if (--pakfire->nrefs > 0)
return pakfire;
- _pakfire_free(pakfire);
+ pakfire_free(pakfire);
return NULL;
}
PAKFIRE_EXPORT void pakfire_set_cache_path(Pakfire pakfire, const char* path) {
// Release old path
if (pakfire->cache_path)
- pakfire_free(pakfire->cache_path);
+ free(pakfire->cache_path);
pakfire->cache_path = pakfire_strdup(path);
// Completely delete the tree of files
int r = nftw(cache_path, _unlink, 64, FTW_DEPTH|FTW_PHYS);
- pakfire_free(cache_path);
+ free(cache_path);
// It is okay if the path doesn't exist
if (r < 0 && errno == ENOENT)
char* cache_path = pakfire_get_cache_path(pakfire, path);
int r = stat(cache_path, buffer);
- pakfire_free(cache_path);
+ free(cache_path);
return r;
}
char* cache_path = pakfire_get_cache_path(pakfire, path);
int r = pakfire_access(pakfire, cache_path, NULL, mode);
- pakfire_free(cache_path);
+ free(cache_path);
return r;
}
f = fopen(cache_path, flags);
FAIL:
- pakfire_free(cache_path);
- pakfire_free(cache_dirname);
+ free(cache_path);
+ free(cache_dirname);
return f;
}
#############################################################################*/
#include <regex.h>
+#include <stdlib.h>
#include <string.h>
#include <pakfire/errno.h>
// Free everything
if (d->name)
- pakfire_free(d->name);
+ free(d->name);
if (d->value)
- pakfire_free(d->value);
- pakfire_free(d);
+ free(d->value);
+ free(d);
}
}
pakfire_parser_free_declarations(parser);
if (parser->namespace)
- pakfire_free(parser->namespace);
+ free(parser->namespace);
pakfire_parser_unref(parser->parent);
pakfire_unref(parser->pakfire);
- pakfire_free(parser);
+ free(parser);
}
PAKFIRE_EXPORT PakfireParser pakfire_parser_unref(PakfireParser parser) {
if (d) {
// Replace value
if (d->value)
- pakfire_free(d->value);
+ free(d->value);
d->value = pakfire_strdup(value);
DEBUG(parser->pakfire, "Updated declaration: %s = %s\n",
char* canonical_name = pakfire_parser_make_canonical_name(parser, name);
int r = pakfire_parser_set_declaration(parser, canonical_name, value);
- pakfire_free(canonical_name);
+ free(canonical_name);
return r;
}
// Set the new value
r = pakfire_parser_set_declaration(parser, name, buffer);
- pakfire_free(buffer);
+ free(buffer);
return r;
}
pakfire_parser_strip_namespace(n);
}
- pakfire_free(buffer);
+ free(buffer);
if (n)
- pakfire_free(n);
+ free(n);
if (!d && parser->parent)
d = pakfire_parser_find_declaration(parser->parent, name);
DEBUG(parser->pakfire, "New buffer: %s\n", b);
// Drop old buffer
- pakfire_free(buffer);
+ free(buffer);
buffer = b;
}
r = pakfire_parser_parse_data(parser, data, len);
if (data)
- pakfire_free(data);
+ free(data);
return r;
}
%{
#include <stdio.h>
+#include <stdlib.h>
#include <time.h>
#include <pakfire/constants.h>
char* dump = pakfire_parser_dump(parent);
DEBUG(pakfire, "Status of the parser %p:\n%s\n", parent, dump);
- pakfire_free(dump);
+ free(dump);
// Log time we needed to parse data
DEBUG(pakfire, "Parser finished in %.4fms\n",
}
pakfire_unref(pakfire);
- pakfire_free(v1);
- pakfire_free(v2);
+ free(v1);
+ free(v2);
return result;
}
int num_lines;
#include <ctype.h>
+#include <stdlib.h>
#include <pakfire/parser.h>
#include <pakfire/util.h>
#include "grammar.h"
unput(buffer[i]);
}
- pakfire_free(buffer);
+ free(buffer);
}
<INITIAL>^{template1}$ {
unput(buffer[i]);
}
- pakfire_free(buffer);
+ free(buffer);
}
<INITIAL>^{template2}$ {
unput(buffer[i]);
}
- pakfire_free(buffer);
+ free(buffer);
}
<INITIAL>^{script} {
unput(buffer[i]);
}
- pakfire_free(buffer);
+ free(buffer);
}
<INITIAL>^{keywords}$ {
unput(buffer[i]);
}
- pakfire_free(buffer);
+ free(buffer);
}
<INITIAL>"==" { return T_EQUALS; }
# #
#############################################################################*/
+#include <stdlib.h>
+
#include <pakfire/constants.h>
#include <pakfire/i18n.h>
#include <pakfire/logging.h>
pakfire_request_unref(problem->request);
if (problem->string)
- pakfire_free(problem->string);
+ free(problem->string);
pakfire_unref(problem->pakfire);
- pakfire_free(problem);
+ free(problem);
}
PAKFIRE_EXPORT PakfireProblem pakfire_problem_unref(PakfireProblem problem) {
#############################################################################*/
#include <assert.h>
+#include <stdlib.h>
#include <solv/pooltypes.h>
#include <solv/queue.h>
PakfireRelation rel = pakfire_relation_create(pakfire, name, cmp2type(*delim), evr);
// Cleanup
- pakfire_free(name);
- pakfire_free(evr);
+ free(name);
+ free(evr);
return rel;
}
DEBUG(relation->pakfire, "Releasing Relation at %p\n", relation);
pakfire_unref(relation->pakfire);
- pakfire_free(relation);
+ free(relation);
}
PAKFIRE_EXPORT PakfireRelation pakfire_relation_unref(PakfireRelation relation) {
#############################################################################*/
#include <errno.h>
+#include <stdlib.h>
#include <solv/pooltypes.h>
#include <solv/queue.h>
pakfire_relation_unref(rel);
}
- pakfire_free(*element);
+ free(*element);
}
- pakfire_free(elements);
+ free(elements);
return 0;
}
pakfire_unref(relationlist->pakfire);
queue_free(&relationlist->queue);
- pakfire_free(relationlist);
+ free(relationlist);
}
PAKFIRE_EXPORT PakfireRelationList pakfire_relationlist_unref(PakfireRelationList relationlist) {
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <solv/repo.h>
// repodata is being destroyed with the repository
if (appdata->description)
- pakfire_free(appdata->description);
+ free(appdata->description);
if (appdata->baseurl)
- pakfire_free(appdata->baseurl);
+ free(appdata->baseurl);
if (appdata->keyfile)
- pakfire_free(appdata->keyfile);
+ free(appdata->keyfile);
if (appdata->mirrorlist)
- pakfire_free(appdata->mirrorlist);
+ free(appdata->mirrorlist);
- pakfire_free(appdata);
+ free(appdata);
}
void pakfire_repo_free_all(Pakfire pakfire) {
DEBUG(repo->pakfire, "Releasing Repo at %p\n", repo);
pakfire_unref(repo->pakfire);
- pakfire_free(repo);
+ free(repo);
}
PAKFIRE_EXPORT PakfireRepo pakfire_repo_unref(PakfireRepo repo) {
PAKFIRE_EXPORT int pakfire_repo_set_description(PakfireRepo repo, const char* description) {
if (repo->appdata->description)
- pakfire_free(repo->appdata->description);
+ free(repo->appdata->description);
if (description)
repo->appdata->description = pakfire_strdup(description);
PAKFIRE_EXPORT int pakfire_repo_set_baseurl(PakfireRepo repo, const char* baseurl) {
if (repo->appdata->baseurl)
- pakfire_free(repo->appdata->baseurl);
+ free(repo->appdata->baseurl);
if (baseurl)
repo->appdata->baseurl = pakfire_strdup(baseurl);
PAKFIRE_EXPORT int pakfire_repo_set_keyfile(PakfireRepo repo, const char* keyfile) {
if (repo->appdata->keyfile)
- pakfire_free(repo->appdata->keyfile);
+ free(repo->appdata->keyfile);
if (keyfile)
repo->appdata->keyfile = pakfire_strdup(keyfile);
PAKFIRE_EXPORT int pakfire_repo_set_mirrorlist(PakfireRepo repo, const char* mirrorlist) {
if (repo->appdata->mirrorlist)
- pakfire_free(repo->appdata->mirrorlist);
+ free(repo->appdata->mirrorlist);
if (mirrorlist)
repo->appdata->mirrorlist = pakfire_strdup(mirrorlist);
// Add the prefix for the repository first
char* cache_path = pakfire_path_join(prefix, path);
- pakfire_free(prefix);
+ free(prefix);
return cache_path;
}
char* repo_cache_path = pakfire_repo_make_cache_path(repo, path);
char* cache_path = pakfire_get_cache_path(repo->pakfire, repo_cache_path);
- pakfire_free(repo_cache_path);
+ free(repo_cache_path);
return cache_path;
}
char* cache_path = pakfire_repo_make_cache_path(repo, path);
FILE* f = pakfire_cache_open(repo->pakfire, cache_path, mode);
- pakfire_free(cache_path);
+ free(cache_path);
return f;
}
char* cache_path = pakfire_repo_make_cache_path(repo, path);
int r = pakfire_cache_access(repo->pakfire, cache_path, mode);
- pakfire_free(cache_path);
+ free(cache_path);
return r;
}
char* cache_path = pakfire_repo_make_cache_path(repo, path);
time_t t = pakfire_cache_age(repo->pakfire, cache_path);
- pakfire_free(cache_path);
+ free(cache_path);
return t;
}
# #
#############################################################################*/
+#include <stdlib.h>
+
#include <solv/queue.h>
#include <solv/solver.h>
#include <solv/transaction.h>
queue_free(&request->queue);
pakfire_unref(request->pakfire);
- pakfire_free(request);
+ free(request);
}
PAKFIRE_EXPORT PakfireRequest pakfire_request_unref(PakfireRequest request) {
#############################################################################*/
#include <assert.h>
+#include <stdlib.h>
#include <solv/pool.h>
#include <solv/queue.h>
DEBUG(selector->pakfire, "Releasing Selector at %p\n", selector);
pakfire_unref(selector->pakfire);
- pakfire_free(selector);
+ free(selector);
}
PAKFIRE_EXPORT PakfireSelector pakfire_selector_unref(PakfireSelector selector) {
#############################################################################*/
#include <assert.h>
+#include <stdlib.h>
#include <solv/policy.h>
if (solution->elements)
while (*solution->elements)
- pakfire_free(*solution->elements++);
+ free(*solution->elements++);
- pakfire_free(solution);
+ free(solution);
}
PAKFIRE_EXPORT PakfireSolution pakfire_solution_unref(PakfireSolution solution) {
pakfire_package_unref(step->package);
pakfire_archive_unref(step->archive);
pakfire_unref(step->pakfire);
- pakfire_free(step);
+ free(step);
}
PAKFIRE_EXPORT PakfireStep pakfire_step_unref(PakfireStep step) {
ERROR(step->pakfire, "Could not open package archive for %s: %s\n",
nevra, cache_path);
- pakfire_free(nevra);
- pakfire_free(cache_path);
+ free(nevra);
+ free(cache_path);
return -1;
}
unlink(path);
// Cleanup
- pakfire_free(path);
+ free(path);
return r;
}
if (r) {
char* nevra = pakfire_package_get_nevra(step->package);
ERROR(step->pakfire, "Could not extract package %s: %d\n", nevra, r);
- pakfire_free(nevra);
+ free(nevra);
}
// Update the runtime linker cache
#############################################################################*/
#include <assert.h>
+#include <stdlib.h>
+
#include <solv/transaction.h>
#include <pakfire/db.h>
pakfire_step_unref(*transaction->steps++);
transaction_free(transaction->transaction);
- pakfire_free(transaction);
+ free(transaction);
}
PAKFIRE_EXPORT PakfireTransaction pakfire_transaction_unref(PakfireTransaction transaction) {
);
pakfire_repo_unref(repo);
- pakfire_free(size_str);
+ free(size_str);
}
static void pakfire_transaction_add_separator(char** str, size_t width) {
asprintf(str, "%s%-21s: %s\n", *str, headline, s);
- pakfire_free(s);
+ free(s);
}
PAKFIRE_EXPORT char* pakfire_transaction_dump(PakfireTransaction transaction, size_t width) {
return ptr;
}
-PAKFIRE_EXPORT void* pakfire_free(void* mem) {
- if (mem)
- free(mem);
-
- return 0;
-}
-
char* pakfire_strdup(const char* s) {
if (!s)
return 0;
if (r)
r = pakfire_strdup(r);
- pakfire_free(name);
+ free(name);
return r;
}
if (r)
r = pakfire_strdup(r);
- pakfire_free(parent);
+ free(parent);
return r;
}
DEBUG(pakfire, "%s does not exist\n", path);
}
- pakfire_free(path);
+ free(path);
return r;
}
if (r)
r = pakfire_mkdir(pakfire, parent, 0);
- pakfire_free(parent);
+ free(parent);
// Exit if parent directory could not be created
if (r)
// Check we encountered any errors
r = ferror(f);
if (r) {
- pakfire_free(*buffer);
+ free(*buffer);
return r;
}
# #
#############################################################################*/
+#include <stdlib.h>
#include <unistd.h>
#include <pakfire/archive.h>
ASSERT(verify == PAKFIRE_ARCHIVE_VERIFY_OK);
pakfire_archive_unref(archive);
- pakfire_free(path);
+ free(path);
return EXIT_SUCCESS;
}
char* path = pakfire_path_join(TEST_SRC_PATH, TEST_PKG1_PATH);
PakfireArchive archive = pakfire_archive_open(t->pakfire, path);
- pakfire_free(path);
+ free(path);
// Extract the archive payload
int r = pakfire_archive_extract(archive, NULL, PAKFIRE_ARCHIVE_USE_PAYLOAD);
char* path = pakfire_path_join(TEST_SRC_PATH, TEST_PKG1_PATH);
PakfireArchive archive = pakfire_archive_open(t->pakfire, path);
- pakfire_free(path);
+ free(path);
PakfireRepo repo = pakfire_repo_create(t->pakfire, "tmp");
ASSERT(repo);
# #
#############################################################################*/
+#include <stdlib.h>
#include <string.h>
#include <pakfire/key.h>
char* dump = pakfire_key_dump(key);
ASSERT(dump);
LOG("%s\n", dump);
- pakfire_free(dump);
+ free(dump);
// Export the key
char* data = pakfire_key_export(key, 0);
ASSERT(data);
LOG("Exported key:\n%s\n", data);
- pakfire_free(data);
+ free(data);
pakfire_key_unref(key);
# #
#############################################################################*/
+#include <stdlib.h>
#include <string.h>
#include <pakfire/parser.h>
ASSERT(value);
printf("VALUE: sources = %s\n", value);
- pakfire_free(value);
+ free(value);
// Cleanup
- pakfire_free(path);
+ free(path);
pakfire_parser_unref(parser);
# #
#############################################################################*/
+#include <stdlib.h>
#include <string.h>
#include <pakfire/parser.h>
// Cleanup
pakfire_parser_unref(subparser);
pakfire_parser_unref(parser);
- pakfire_free(value);
+ free(value);
return EXIT_SUCCESS;
}
# #
#############################################################################*/
+#include <stdlib.h>
#include <string.h>
#include <pakfire/parser.h>
char* output = pakfire_basename(dir);
ASSERT_STRING_EQUALS(output, "c");
- pakfire_free(output);
+ free(output);
return EXIT_SUCCESS;
}
char* output = pakfire_dirname(dir);
ASSERT_STRING_EQUALS(output, "/a/b");
- pakfire_free(output);
+ free(output);
return EXIT_SUCCESS;
}