Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Stricter assert (arrays are 0 indexed).
jlaffaye committed 14 years ago
commit e9a0d081c1cb8189cbd5150628c2a0e22e9c6867
parent 94bb1b4
1 file changed +2 -2
modified libpkg/pkg.c
@@ -118,7 +118,7 @@ const char *
pkg_get(struct pkg const * const pkg, const pkg_attr attr)
{
	assert(pkg != NULL);
-
	assert(attr <= PKG_NUM_FIELDS);
+
	assert(attr < PKG_NUM_FIELDS);

	if ((pkg->fields[attr].type & pkg->type) == 0)
		EMIT_PKG_ERROR("%s", "wrong usage of `attr` for this type of `pkg`");
@@ -132,7 +132,7 @@ pkg_set(struct pkg * pkg, pkg_attr attr, const char *value)
	struct sbuf **sbuf;

	assert(pkg != NULL);
-
	assert(attr <= PKG_NUM_FIELDS);
+
	assert(attr < PKG_NUM_FIELDS);
	assert(value != NULL || pkg->fields[attr].optional == 1);

	if (value == NULL)