Exemplo n.º 1
0
static inline mowgli_getopt_option_t *
mowgli_program_opts_convert(const mowgli_program_opts_t *opts, size_t opts_size)
{
	mowgli_getopt_option_t *g_opts;
	size_t i;

	return_val_if_fail(opts != NULL, NULL);

	g_opts = mowgli_alloc_array(sizeof(mowgli_getopt_option_t), opts_size);

	for (i = 0; i < opts_size; i++)
	{
		if (opts[i].longopt == NULL)
			continue;

		g_opts[i].name = opts[i].longopt;
		g_opts[i].iflag = i;

		if (opts[i].has_param)
			g_opts[i].has_arg = 1;
	}

	return g_opts;
}
Exemplo n.º 2
0
/*
 * \brief Allocates an object of "size" size.
 *
 * This is the equivilant of calling mowgli_alloc_array(size, 1).
 *
 * \param size size of object to allocate.
 *
 * \return A pointer to a memory buffer.
 */
void *
mowgli_alloc(size_t size)
{
	return mowgli_alloc_array(size, 1);
}