]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
cfg_list_first() now returns NULL if the list is NULL.
authorBrian Wellington <source@isc.org>
Tue, 27 Feb 2001 01:49:46 +0000 (01:49 +0000)
committerBrian Wellington <source@isc.org>
Tue, 27 Feb 2001 01:49:46 +0000 (01:49 +0000)
lib/isccfg/include/isccfg/cfg.h
lib/isccfg/parser.c

index b6b4131c720d46e0d2ce4fdf8e74fc5dc3a11208..72fdc9fe31bcaaadcd1eb283b61b87e1d651bbfd 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: cfg.h,v 1.16 2001/02/26 22:37:34 gson Exp $ */
+/* $Id: cfg.h,v 1.17 2001/02/27 01:49:46 bwelling Exp $ */
 
 #ifndef DNS_CFG_H
 #define DNS_CFG_H 1
@@ -303,11 +303,11 @@ cfg_list_first(cfg_obj_t *obj);
  * Returns the first list element in a configuration object of a list type.
  *
  * Requires:
- *      'obj' points to a valid configuration object of a list type.
+ *      'obj' points to a valid configuration object of a list type or NULL.
  *
  * Returns:
  *      A pointer to a cfg_listelt_t representing the first list element,
- *     or NULL if the list is empty.
+ *     or NULL if the list is empty or nonexistent.
  */
 
 cfg_listelt_t *
index c85052102d35ebf37ca31a7b3b2a38d39b2fd935..ab19e8affee3b1a5ca0c55ea083d5c58bde47f83 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: parser.c,v 1.27 2001/02/27 01:31:56 gson Exp $ */
+/* $Id: parser.c,v 1.28 2001/02/27 01:49:44 bwelling Exp $ */
 
 #include <config.h>
 
@@ -1919,7 +1919,9 @@ cfg_obj_islist(cfg_obj_t *obj) {
 
 cfg_listelt_t *
 cfg_list_first(cfg_obj_t *obj) {
-       REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_list);
+       REQUIRE(obj == NULL || obj->type->rep == &cfg_rep_list);
+       if (obj == NULL)
+               return (NULL);
        return (ISC_LIST_HEAD(obj->value.list));
 }