map.c revision a747113422afaa29ce72d2c5ba7f0b7ea9ec2054
/*
* Automated Testing Framework (atf)
*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "map.h"
#include "sanity.h"
/* ---------------------------------------------------------------------
* Auxiliary functions.
* --------------------------------------------------------------------- */
struct map_entry {
char *m_key;
void *m_value;
bool m_managed;
};
static
struct map_entry *
{
} else {
}
}
return me;
}
/* ---------------------------------------------------------------------
* The "atf_map_citer" type.
* --------------------------------------------------------------------- */
/*
* Getters.
*/
const char *
{
}
const void *
{
}
{
return newciter;
}
bool
const atf_map_citer_t i2)
{
}
/* ---------------------------------------------------------------------
* The "atf_map_iter" type.
* --------------------------------------------------------------------- */
/*
* Getters.
*/
const char *
{
}
void *
{
}
{
return newiter;
}
bool
const atf_map_iter_t i2)
{
}
/* ---------------------------------------------------------------------
* The "atf_map" type.
* --------------------------------------------------------------------- */
/*
* Constructors and destructors.
*/
{
return atf_list_init(&m->m_list);
}
{
err = atf_map_init(m);
ptr++;
break;
}
ptr++;
}
}
if (atf_is_error(err))
atf_map_fini(m);
return err;
}
void
{
}
atf_list_fini(&m->m_list);
}
/*
* Getters.
*/
{
return iter;
}
atf_map_begin_c(const atf_map_t *m)
{
return citer;
}
atf_map_end(atf_map_t *m)
{
return iter;
}
atf_map_end_c(const atf_map_t *m)
{
return iter;
}
{
i.m_map = m;
i.m_listiter = iter;
return i;
}
}
return atf_map_end(m);
}
{
i.m_map = m;
i.m_listiter = iter;
return i;
}
}
return atf_map_end_c(m);
}
atf_map_size(const atf_map_t *m)
{
return atf_list_size(&m->m_list);
}
char **
atf_map_to_charpp(const atf_map_t *l)
{
char **array;
size_t i;
goto out;
i = 0;
atf_map_for_each_c(iter, l) {
goto out;
}
goto out;
}
i += 2;
}
out:
return array;
}
/*
* Modifiers.
*/
{
err = atf_no_memory_error();
else {
if (atf_is_error(err)) {
if (managed)
}
}
} else {
err = atf_no_error();
}
return err;
}