Commit 94811367 authored by Brian Wellington's avatar Brian Wellington
Browse files

cfg_list_first() now returns NULL if the list is NULL.

parent d011c10d
......@@ -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 *
......
......@@ -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));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment