Skip to content

Commit cfa9e33

Browse files
committed
lib: make xbps_alternatives_{un,}register private
1 parent 99a18f3 commit cfa9e33

File tree

4 files changed

+8
-30
lines changed

4 files changed

+8
-30
lines changed

include/xbps.h.in

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,26 +1011,6 @@ int xbps_pkg_exec_script(struct xbps_handle *xhp,
10111011
*/
10121012
int xbps_alternatives_set(struct xbps_handle *xhp, const char *pkg, const char *group);
10131013

1014-
/**
1015-
* Registers all alternative groups provided by a package.
1016-
*
1017-
* @param[in] xhp The pointer to the xbps_handle struct.
1018-
* @param[in] pkgd Package dictionary as stored in the transaction dictionary.
1019-
*
1020-
* @return 0 on success, or an errno value otherwise.
1021-
*/
1022-
int xbps_alternatives_register(struct xbps_handle *xhp, xbps_dictionary_t pkgd);
1023-
1024-
/**
1025-
* Unregisters all alternative groups provided by a package.
1026-
*
1027-
* @param[in] xhp The pointer to the xbps_handle struct.
1028-
* @param[in] pkgd Package dictionary as stored in the transaction dictionary.
1029-
*
1030-
* @return 0 on success, or an errno value otherwise.
1031-
*/
1032-
int xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd);
1033-
10341014
/**
10351015
* Parse the alternative link path into \a path and optionally the
10361016
* symlink target into \a target.

include/xbps_api_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ xbps_dictionary_t HIDDEN xbps_find_pkg_in_array(xbps_array_t, const char *,
9191
xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_array(struct xbps_handle *,
9292
xbps_array_t, const char *, xbps_trans_type_t);
9393

94+
/* alternatives */
95+
int HIDDEN xbps_alternatives_register(struct xbps_handle *, xbps_dictionary_t);
96+
int HIDDEN xbps_alternatives_unregister(struct xbps_handle *, xbps_dictionary_t, bool);
97+
9498
/* transaction */
9599
bool HIDDEN xbps_transaction_check_revdeps(struct xbps_handle *, xbps_array_t);
96100
bool HIDDEN xbps_transaction_check_shlibs(struct xbps_handle *, xbps_array_t);

lib/package_alternatives.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,12 @@ switch_alt_group(struct xbps_handle *xhp, const char *grpn, const char *pkgn,
283283
return create_symlinks(xhp, xbps_dictionary_get(pkgalts, grpn), grpn);
284284
}
285285

286-
int
287-
xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
286+
int HIDDEN
287+
xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool update)
288288
{
289289
xbps_array_t allkeys;
290290
xbps_dictionary_t alternatives, pkg_alternatives;
291291
const char *pkgver, *pkgname;
292-
bool update = false;
293292
int rv = 0;
294293

295294
assert(xhp);
@@ -305,8 +304,6 @@ xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
305304
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
306305
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgname", &pkgname);
307306

308-
xbps_dictionary_get_bool(pkgd, "alternatives-update", &update);
309-
310307
allkeys = xbps_dictionary_all_keys(pkg_alternatives);
311308
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
312309
xbps_array_t array;
@@ -490,7 +487,7 @@ remove_obsoletes(struct xbps_handle *xhp, const char *pkgname, const char *pkgve
490487
xbps_object_release(allkeys);
491488
}
492489

493-
int
490+
int HIDDEN
494491
xbps_alternatives_register(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod)
495492
{
496493
xbps_array_t allkeys;

lib/package_remove.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
159159
goto out;
160160

161161
/* unregister alternatives */
162-
if (update)
163-
xbps_dictionary_set_bool(pkgd, "alternatives-update", true);
164-
165-
if ((rv = xbps_alternatives_unregister(xhp, pkgd)) != 0)
162+
if ((rv = xbps_alternatives_unregister(xhp, pkgd, update)) != 0)
166163
goto out;
167164

168165
/*

0 commit comments

Comments
 (0)