示例#1
0
static char *format_array_alloc(const char *fmt, u32 *array, unsigned array_size)
{
	size_t len = format_array(NULL, 0, fmt, array, array_size);
	char *ret;

	ret = kmalloc(len, GFP_KERNEL);
	if (ret == NULL)
		return NULL;

	format_array(ret, len, fmt, array, array_size);
	return ret;
}
示例#2
0
bool print_parameter(const std::string& Type, std::ostream& Stream, const parameter& RHS)
{
	typedef const typed_array<T> array_t;

	if(array_t* const array = dynamic_cast<array_t*>(RHS.storage.get()))
	{
		// First, print the parameter name, with optional inline type info (only if inlining is enabled and the type isn't predefined) ...
		Stream << "\"";

		if(inline_types(Stream))
		{
			if(!detail::predefined_types().count(RHS.name))
			{
				Stream << RHS.storage_class << " " << Type << " ";
				if(RHS.tuple_size > 1)
					Stream << "[" << RHS.tuple_size << "] ";
			}
		}

		Stream << RHS.name << "\" ";

		// Next, print the parameter values
		Stream << format_array(array->begin(), array->end());

		return true;
	}

	return false;
}