Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Constify (constipate?) various accessor routines
Matthew Seaman committed 12 years ago
commit 1f10cf83a2ac60532cbdfc2ef2e5b9d5bfdb4bab
parent 4f21786
2 files changed +21 -20
modified libpkg/pkg.c
@@ -383,7 +383,7 @@ pkg_set_from_file(struct pkg *pkg, pkg_attr attr, const char *path, bool trimcr)
}

int
-
pkg_licenses(struct pkg *pkg, struct pkg_license **l)
+
pkg_licenses(const struct pkg *pkg, struct pkg_license **l)
{
	assert(pkg != NULL);

@@ -391,7 +391,7 @@ pkg_licenses(struct pkg *pkg, struct pkg_license **l)
}

int
-
pkg_users(struct pkg *pkg, struct pkg_user **u)
+
pkg_users(const struct pkg *pkg, struct pkg_user **u)
{
	assert(pkg != NULL);

@@ -399,7 +399,7 @@ pkg_users(struct pkg *pkg, struct pkg_user **u)
}

int
-
pkg_groups(struct pkg *pkg, struct pkg_group **g)
+
pkg_groups(const struct pkg *pkg, struct pkg_group **g)
{
	assert(pkg != NULL);

@@ -407,7 +407,7 @@ pkg_groups(struct pkg *pkg, struct pkg_group **g)
}

int
-
pkg_deps(struct pkg *pkg, struct pkg_dep **d)
+
pkg_deps(const struct pkg *pkg, struct pkg_dep **d)
{
	assert(pkg != NULL);

@@ -415,7 +415,7 @@ pkg_deps(struct pkg *pkg, struct pkg_dep **d)
}

int
-
pkg_rdeps(struct pkg *pkg, struct pkg_dep **d)
+
pkg_rdeps(const struct pkg *pkg, struct pkg_dep **d)
{
	assert(pkg != NULL);

@@ -423,7 +423,7 @@ pkg_rdeps(struct pkg *pkg, struct pkg_dep **d)
}

int
-
pkg_files(struct pkg *pkg, struct pkg_file **f)
+
pkg_files(const struct pkg *pkg, struct pkg_file **f)
{
	assert(pkg != NULL);

@@ -431,7 +431,7 @@ pkg_files(struct pkg *pkg, struct pkg_file **f)
}

int
-
pkg_categories(struct pkg *pkg, struct pkg_category **c)
+
pkg_categories(const struct pkg *pkg, struct pkg_category **c)
{
	assert(pkg != NULL);

@@ -439,7 +439,7 @@ pkg_categories(struct pkg *pkg, struct pkg_category **c)
}

int
-
pkg_dirs(struct pkg *pkg, struct pkg_dir **d)
+
pkg_dirs(const struct pkg *pkg, struct pkg_dir **d)
{
	assert(pkg != NULL);

@@ -447,7 +447,7 @@ pkg_dirs(struct pkg *pkg, struct pkg_dir **d)
}

int
-
pkg_options(struct pkg *pkg, struct pkg_option **o)
+
pkg_options(const struct pkg *pkg, struct pkg_option **o)
{
	assert(pkg != NULL);

@@ -948,7 +948,7 @@ pkg_delannotation(struct pkg *pkg, const char *tag)
}

int
-
pkg_list_count(struct pkg *pkg, pkg_list list)
+
pkg_list_count(const struct pkg *pkg, pkg_list list)
{
	switch (list) {
	case PKG_DEPS:
modified libpkg/pkg.h.in
@@ -518,13 +518,14 @@ int pkg_get2(struct pkg const *const, ...);
const char *pkg_name(struct pkg const *const pkg);
const char *pkg_version(struct pkg const *const pkg);

-
int pkg_list_count(struct pkg *, pkg_list);
+
int pkg_list_count(const struct pkg *, pkg_list);
+

/**
 * Iterates over the dependencies of the package.
 * @param dep Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_deps(struct pkg *, struct pkg_dep **dep);
+
int pkg_deps(const struct pkg *, struct pkg_dep **dep);

/**
 * Iterates over the reverse dependencies of the package.
@@ -532,56 +533,56 @@ int pkg_deps(struct pkg *, struct pkg_dep **dep);
 * @param dep Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_rdeps(struct pkg *, struct pkg_dep **dep);
+
int pkg_rdeps(const struct pkg *, struct pkg_dep **dep);

/**
 * Iterates over the files of the package.
 * @param file Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_files(struct pkg *, struct pkg_file **file);
+
int pkg_files(const struct pkg *, struct pkg_file **file);

/**
 * Iterates over the directories of the package.
 * @param Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_dirs(struct pkg *pkg, struct pkg_dir **dir);
+
int pkg_dirs(const struct pkg *pkg, struct pkg_dir **dir);

/**
 * Iterates over the categories of the package.
 * @param Must be set to NULL for the first call.
 * @return An error code
 */
-
int pkg_categories(struct pkg *pkg, struct pkg_category **category);
+
int pkg_categories(const struct pkg *pkg, struct pkg_category **category);

/**
 * Iterates over the licenses of the package.
 * @param Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_licenses(struct pkg *pkg, struct pkg_license **license);
+
int pkg_licenses(const struct pkg *pkg, struct pkg_license **license);

/**
 * Iterates over the users of the package.
 * @param Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_users(struct pkg *pkg, struct pkg_user **user);
+
int pkg_users(const struct pkg *pkg, struct pkg_user **user);

/**
 * Iterates over the groups of the package.
 * @param Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_groups(struct pkg *pkg, struct pkg_group **group);
+
int pkg_groups(const struct pkg *pkg, struct pkg_group **group);

/**
 * Iterates over the options of the package.
 * @param  option Must be set to NULL for the first call.
 * @return An error code.
 */
-
int pkg_options(struct pkg *, struct pkg_option **option);
+
int pkg_options(const struct pkg *, struct pkg_option **option);

/**
 * Iterates over the shared libraries used by the package.