Compare commits

..

No commits in common. "be1ea7888bc7e882a6c1e17573be35a08b5637e9" and "752a9825dc8660d247c457aa4d256db4800ebd7c" have entirely different histories.

10 changed files with 25 additions and 68 deletions

View File

@ -72,7 +72,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
memset(buf, 0, strlen(src) + 1);
*argv = calloc(argv_size, sizeof (void *));
*argv = calloc(sizeof (void *), argv_size);
(*argv)[argc_count] = dst_iter;
while (*src_iter)

View File

@ -161,7 +161,7 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
pkgconf_client_t *
pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
{
pkgconf_client_t *out = calloc(1, sizeof(pkgconf_client_t));
pkgconf_client_t *out = calloc(sizeof(pkgconf_client_t), 1);
pkgconf_client_init(out, error_handler, error_handler_data, personality);
return out;
}

View File

@ -130,7 +130,7 @@ pkgconf_dependency_addraw(pkgconf_client_t *client, pkgconf_list_t *list, const
{
pkgconf_dependency_t *dep;
dep = calloc(1, sizeof(pkgconf_dependency_t));
dep = calloc(sizeof(pkgconf_dependency_t), 1);
dep->package = pkgconf_strndup(package, package_sz);
if (version_sz != 0)
@ -469,7 +469,7 @@ pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *de
{
pkgconf_dependency_t *new_dep;
new_dep = calloc(1, sizeof(pkgconf_dependency_t));
new_dep = calloc(sizeof(pkgconf_dependency_t), 1);
new_dep->package = strdup(dep->package);
if (dep->version != NULL)

View File

@ -143,7 +143,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
if (strlen(string) > 1 && !pkgconf_fragment_is_special(string))
{
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag->type = *(string + 1);
frag->data = pkgconf_fragment_copy_munged(client, string + 2, flags);
@ -192,7 +192,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
}
}
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag->type = 0;
frag->data = strdup(string);
@ -353,7 +353,7 @@ pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, cons
else if (!is_private && !pkgconf_fragment_can_merge_back(base, client->flags, is_private) && (pkgconf_fragment_lookup(list, base) != NULL))
return;
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag->type = base->type;
frag->merged = base->merged;
@ -427,7 +427,7 @@ fragment_quote(const pkgconf_fragment_t *frag)
if (frag->data == NULL)
return NULL;
out = dst = calloc(1, outlen);
out = dst = calloc(outlen, 1);
for (; *src; src++)
{

View File

@ -278,7 +278,6 @@ PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *p
#define PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS 0x4000
#define PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES 0x8000
#define PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES 0x10000
#define PKGCONF_PKG_PKGF_ANCESTOR 0x20000
#define PKGCONF_PKG_DEPF_INTERNAL 0x1
#define PKGCONF_PKG_DEPF_PRIVATE 0x2

View File

@ -90,7 +90,7 @@ prepare_path_node(const char *text, pkgconf_list_t *dirlist, bool filter)
return NULL;
#endif
node = calloc(1, sizeof(pkgconf_path_t));
node = calloc(sizeof(pkgconf_path_t), 1);
node->path = strdup(path);
#ifdef PKGCONF_CACHE_INODES
@ -266,7 +266,7 @@ pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
{
pkgconf_path_t *srcpath = n->data, *path;
path = calloc(1, sizeof(pkgconf_path_t));
path = calloc(sizeof(pkgconf_path_t), 1);
path->path = strdup(srcpath->path);
#ifdef PKGCONF_CACHE_INODES

View File

@ -241,25 +241,23 @@ personality_warn_func(void *p, const char *fmt, ...)
}
static pkgconf_cross_personality_t *
load_personality_with_path(const char *path, const char *triplet, bool datadir)
load_personality_with_path(const char *path, const char *triplet)
{
char pathbuf[PKGCONF_ITEM_SIZE];
FILE *f;
pkgconf_cross_personality_t *p;
/* if triplet is null, assume that path is a direct path to the personality file */
if (triplet == NULL)
pkgconf_strlcpy(pathbuf, path, sizeof pathbuf);
else if (datadir)
snprintf(pathbuf, sizeof pathbuf, "%s/pkgconfig/personality.d/%s.personality", path, triplet);
else
if (triplet != NULL)
snprintf(pathbuf, sizeof pathbuf, "%s/%s.personality", path, triplet);
else
pkgconf_strlcpy(pathbuf, path, sizeof pathbuf);
f = fopen(pathbuf, "r");
if (f == NULL)
return NULL;
p = calloc(1, sizeof(pkgconf_cross_personality_t));
p = calloc(sizeof(pkgconf_cross_personality_t), 1);
if (triplet != NULL)
p->name = strdup(triplet);
pkgconf_parser_parse(f, p, personality_parser_ops, personality_warn_func, pathbuf);
@ -283,51 +281,21 @@ pkgconf_cross_personality_find(const char *triplet)
pkgconf_list_t plist = PKGCONF_LIST_INITIALIZER;
pkgconf_node_t *n;
pkgconf_cross_personality_t *out = NULL;
#if ! defined(_WIN32) && ! defined(__HAIKU__)
char pathbuf[PKGCONF_ITEM_SIZE];
const char *envvar;
#endif
out = load_personality_with_path(triplet, NULL, false);
out = load_personality_with_path(triplet, NULL);
if (out != NULL)
return out;
if (!valid_triplet(triplet))
return NULL;
#if ! defined(_WIN32) && ! defined(__HAIKU__)
envvar = getenv("XDG_DATA_HOME");
if (envvar != NULL)
pkgconf_path_add(envvar, &plist, true);
else {
envvar = getenv("HOME");
if (envvar != NULL) {
pkgconf_strlcpy(pathbuf, envvar, sizeof pathbuf);
pkgconf_strlcat(pathbuf, "/.local/share", sizeof pathbuf);
pkgconf_path_add(pathbuf, &plist, true);
}
}
pkgconf_path_build_from_environ("XDG_DATA_DIRS", "/usr/local/share" PKG_CONFIG_PATH_SEP_S "/usr/share", &plist, true);
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
{
pkgconf_path_t *pn = n->data;
out = load_personality_with_path(pn->path, triplet, true);
if (out != NULL)
goto finish;
}
pkgconf_path_free(&plist);
#endif
pkgconf_path_split(PERSONALITY_PATH, &plist, true);
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
{
pkgconf_path_t *pn = n->data;
out = load_personality_with_path(pn->path, triplet, false);
out = load_personality_with_path(pn->path, triplet);
if (out != NULL)
goto finish;
}

View File

@ -250,7 +250,7 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen)
static char *
convert_path_to_value(const char *path)
{
char *buf = calloc(1, (strlen(path) + 1) * 2);
char *buf = calloc((strlen(path) + 1) * 2, 1);
char *bptr = buf;
const char *i;
@ -419,7 +419,7 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
pkgconf_pkg_t *pkg;
char *idptr;
pkg = calloc(1, sizeof(pkgconf_pkg_t));
pkg = calloc(sizeof(pkgconf_pkg_t), 1);
pkg->owner = client;
pkg->filename = strdup(filename);
pkg->pc_filedir = pkg_get_parent_dir(pkg);
@ -1487,8 +1487,6 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
pkgconf_node_t *node, *next;
parent->flags |= PKGCONF_PKG_PKGF_ANCESTOR;
PKGCONF_FOREACH_LIST_ENTRY_SAFE(deplist->head, next, node)
{
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
@ -1509,7 +1507,7 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
if (pkgdep == NULL)
continue;
if((pkgdep->flags & PKGCONF_PKG_PKGF_ANCESTOR) != 0)
if (pkgdep->serial == client->serial && !(parent->flags & PKGCONF_PKG_PROPF_VIRTUAL))
{
pkgdep->identifier = ++client->identifier;
@ -1547,8 +1545,6 @@ next:
pkgconf_pkg_unref(client, pkgdep);
}
parent->flags &= ~PKGCONF_PKG_PKGF_ANCESTOR;
return eflags;
}

View File

@ -43,7 +43,7 @@
void
pkgconf_queue_push(pkgconf_list_t *list, const char *package)
{
pkgconf_queue_t *pkgq = calloc(1, sizeof(pkgconf_queue_t));
pkgconf_queue_t *pkgq = calloc(sizeof(pkgconf_queue_t), 1);
pkgq->package = strdup(package);
pkgconf_node_insert_tail(&pkgq->iter, pkgq, list);
@ -228,17 +228,11 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis
{
unsigned int result;
pkgconf_pkg_t initial_world = {
.id = "virtual:world",
.realname = "virtual world package",
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
};
if (!pkgconf_queue_compile(client, &initial_world, list))
if (!pkgconf_queue_compile(client, world, list))
return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK;
/* collect all the dependencies */
result = pkgconf_pkg_traverse(client, &initial_world, pkgconf_queue_collect_dependents, world, maxdepth, 0);
result = pkgconf_pkg_traverse(client, world, pkgconf_queue_collect_dependents, world, maxdepth, 0);
if (result != PKGCONF_PKG_ERRF_OK)
return result;

View File

@ -156,7 +156,7 @@ pkgconf_tuple_find_delete(pkgconf_list_t *list, const char *key)
static char *
dequote(const char *value)
{
char *buf = calloc(1, (strlen(value) + 1) * 2);
char *buf = calloc((strlen(value) + 1) * 2, 1);
char *bptr = buf;
const char *i;
char quote = 0;
@ -236,7 +236,7 @@ pkgconf_tuple_t *
pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key, const char *value, bool parse, unsigned int flags)
{
char *dequote_value;
pkgconf_tuple_t *tuple = calloc(1, sizeof(pkgconf_tuple_t));
pkgconf_tuple_t *tuple = calloc(sizeof(pkgconf_tuple_t), 1);
pkgconf_tuple_find_delete(list, key);