[pacman-dev] libalpm data structures

Nagy Gabor ngaba at bibl.u-szeged.hu
Fri Oct 19 12:56:17 EDT 2007


Hi!
This is discussion-only (==no-patch) e-mail, mainly about code clean-up, so if
you don't like that type of e-mails, please skip this.
Xavier's compute_requiredby catch was the motivation of this e-mail:
I never liked the following method:
pmdepend_t *dep = alpm_splitdep(depend) /* char -> pmdepend_t conversion */
...alpm_depcmp(pkg, dep)...
FREE(dep) /* usually forgotten */
So I asked myself: Do we really need pmdepend_t struct? Why don't we use it in
alpm_depcmp only ("internally")? So the depend-input of alpm_depcmp could be
char* (and pmdepend_t should be disappear from libalpm API).

Then I read the .h files of libalpm. My impressions:
1. We don't need pmdepend_t => pmdepmod_t. See above. This is mainly used in
pmdepmissing_t which is used to collect missing dependencies (pmdepmissing_t is
not needed here neither), and to print error/log messages (usually pmdepend_t ->
char conversion is done here, too); where we could also use char.
2. We have pmconflict_t. Nice. So we don't need pmdeptype_t (in pmdepmissing_t).
As we discussed with Xavier, pmconflict_t should be a symmetric structure:
{target,ctarget} set [<=> alpm_strcmp ordered (target, ctarget) pair] instead of
(target,ctarget) ordered pair) <- this is a pmconflict_t-helper-function problem
only.
Future plans:
3. I still want to kill pmsyncpkg_t => pmsynctype_t (the ugliest data struct of
libalpm)
4. If my preferred universal transaction becomes true, we won't need pmtranstype_t.
And of course, if we rip off some unneeded structures, we also rip off tons of
unneeded associated helper functions.

Personally, I want to make a patch for 1. and 2. So if you don't like the idea,
let me know. However, I'm a bit unsure in 2.: should I keep target and ctarget
as char, or I should use pmpkg_t* instead <- faster but more "dangerous".

Bye, ngaba


----------------------------------------------------
SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/





More information about the pacman-dev mailing list