Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
swap the pkg_attr to begin with a 1 to avoid problems when va_arg return NULL
Baptiste Daroussin committed 14 years ago
commit 7eda1997e66ed4b491fad02e452be905f9de5a1b
parent 05b8756b125910f2d2324974c9103ac8a87beaef
2 files changed +3 -3
modified libpkg/pkg.c
@@ -159,7 +159,7 @@ pkg_vget(struct pkg const *const pkg, va_list ap)
{
	int attr;

-
	while ((attr = va_arg(ap, int)) != -1) {
+
	while ((attr = va_arg(ap, int)) > 0) {
		if (attr < PKG_NUM_FIELDS) {
			*va_arg(ap, const char **) = sbuf_get(pkg->fields[attr]);
			continue;
@@ -212,7 +212,7 @@ pkg_vset(struct pkg *pkg, va_list ap)
{
	int attr;

-
	while ((attr = va_arg(ap, int)) != -1) {
+
	while ((attr = va_arg(ap, int)) > 0) {
		if (attr < PKG_NUM_FIELDS) {
			struct sbuf **sbuf;
			const char *str = va_arg(ap, const char *);
modified libpkg/pkg.h
@@ -117,7 +117,7 @@ typedef enum {
 * Used by pkg_get() and pkg_set()
 */
typedef enum {
-
	PKG_ORIGIN = 0,
+
	PKG_ORIGIN = 1,
	PKG_NAME,
	PKG_VERSION,
	PKG_COMMENT,