summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm_list.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-12-08 15:13:36 +1000
committerDan McGee <dan@archlinux.org>2011-01-07 21:15:46 -0600
commitf966f3a8344cd96bd675c79a5c470c66920b890c (patch)
treec97116b7cc0ca1dca8bed3f050ab18dc28a05585 /lib/libalpm/alpm_list.c
parent4bc6ed56aa48784c8caf56c3a6fb1a3c972d221c (diff)
downloadpacman-f966f3a8344cd96bd675c79a5c470c66920b890c.tar.xz
Use size_t for alpm_list sizes
There is a lot of swtiching between size_t and int for alpm_list sizes in the codebase. Start converting these to all be size_t by adjusting the return type of alpm_list_count and fixing all additional warnings given by -Wconversion that are generated by this change. Dan: a few more small changes to ensure things compile, adjusting some printf format string characters to accommodate the larger size on x86_64. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm_list.c')
-rw-r--r--lib/libalpm/alpm_list.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index b7b2a89f..3f9525e8 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -269,7 +269,7 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
*
* @return the resultant list
*/
-alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
+alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
{
if (n > 1) {
alpm_list_t *left = list;
@@ -511,7 +511,7 @@ inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
*
* @return an alpm_list_t node for index `n`
*/
-alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
+alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, size_t n)
{
const alpm_list_t *i = list;
while(n--) {
@@ -574,9 +574,9 @@ void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
*
* @return the number of list items
*/
-int SYMEXPORT alpm_list_count(const alpm_list_t *list)
+size_t SYMEXPORT alpm_list_count(const alpm_list_t *list)
{
- unsigned int i = 0;
+ size_t i = 0;
const alpm_list_t *lp = list;
while(lp) {
++i;