Commit 2f66295f authored by Timo Teräs's avatar Timo Teräs

solver: merge apk_name_state to apk_name

apk_name_state is now quite small; and we avoid overhead of two
pointers (+ malloc overhead) when we just make it part of apk_name.
It also fixes some problems (that got introduced) where apk_name_state
was not allocated.
parent 15adb047
......@@ -18,6 +18,9 @@
#include "apk_package.h"
#include "apk_io.h"
#include "apk_provider_data.h"
#include "apk_solver_data.h"
extern const char * const apk_index_gz;
extern const char * const apkindex_tar_gz;
......@@ -78,25 +81,18 @@ struct apk_db_dir_instance {
gid_t gid;
};
#define PROVIDER_FMT "%s%s"BLOB_FMT
#define PROVIDER_PRINTF(n,p) (n)->name, (p)->version->len ? "-" : "", BLOB_PRINTF(*(p)->version)
struct apk_provider {
struct apk_package *pkg;
apk_blob_t *version;
};
APK_ARRAY(apk_provider_array, struct apk_provider);
struct apk_name {
apk_hash_node hash_node;
union {
int state_int;
void *state_ptr;
};
char *name;
struct apk_provider_array *providers;
struct apk_name_array *rdepends;
struct apk_name_array *rinstall_if;
union {
struct apk_solver_name_state ss;
void *state_ptr;
int state_int;
};
};
struct apk_repository {
......
/* apk_provider_data.h - Alpine Package Keeper (APK)
*
* Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
* Copyright (C) 2008-2012 Timo Teräs <timo.teras@iki.fi>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
#ifndef APK_PROVIDER_DATA_H
#define APK_PROVIDER_DATA_H
#include "apk_defines.h"
#include "apk_blob.h"
struct apk_provider {
struct apk_package *pkg;
apk_blob_t *version;
};
APK_ARRAY(apk_provider_array, struct apk_provider);
#define PROVIDER_FMT "%s%s"BLOB_FMT
#define PROVIDER_PRINTF(n,p) (n)->name, (p)->version->len ? "-" : "", BLOB_PRINTF(*(p)->version)
#endif
......@@ -12,6 +12,9 @@
#ifndef APK_SOLVER_H
#define APK_SOLVER_H
struct apk_name;
struct apk_package;
struct apk_solution_entry {
struct apk_package *pkg;
unsigned short repository_tag : 15;
......
/* apk_solver_data.h - Alpine Package Keeper (APK)
*
* Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
* Copyright (C) 2008-2012 Timo Teräs <timo.teras@iki.fi>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
#ifndef APK_SOLVER_DATA_H
#define APK_SOLVER_DATA_H
#include "apk_defines.h"
#include "apk_provider_data.h"
struct apk_solver_name_state {
/* dynamic */
struct list_head unsolved_list;
struct apk_provider chosen;
unsigned int last_touched_decision;
unsigned short requirers;
unsigned short install_ifs;
unsigned short preferred_pinning;
unsigned short locked;
/* one time prepare/finish flags */
unsigned solver_flags_local : 4;
unsigned solver_flags_inheritable : 4;
unsigned decision_counted : 1;
unsigned originally_installed : 1;
unsigned has_available_pkgs : 1;
unsigned in_changeset : 1;
unsigned in_world_dependency : 1;
/* dynamic state flags */
unsigned none_excluded : 1;
unsigned name_touched : 1;
unsigned preferred_chosen : 1;
};
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment