File diff r19199:282bcb8c74d4 → r19200:843e97bfe892
src/debug.cpp
Show inline comments
 
@@ -70,12 +70,37 @@ struct DebugLevel {
 
#ifdef RANDOM_DEBUG
 
	DEBUG_LEVEL(random),
 
#endif
 
	};
 
#undef DEBUG_LEVEL
 

	
 
/**
 
 * Dump the available debug facility names in the help text.
 
 * @param buf Start address for storing the output.
 
 * @param last Last valid address for storing the output.
 
 * @return Next free position in the output.
 
 */
 
char *DumpDebugFacilityNames(char *buf, char *last)
 
{
 
	int length = 0;
 
	for (const DebugLevel *i = debug_level; i != endof(debug_level); ++i) {
 
		if (length == 0) {
 
			buf = strecpy(buf, "List of debug facility names:\n", last);
 
		} else {
 
			buf = strecpy(buf, ", ", last);
 
			length += 2;
 
		}
 
		buf = strecpy(buf, i->name, last);
 
		length += strlen(i->name);
 
	}
 
	if (length > 0) {
 
		buf = strecpy(buf, "\n\n", last);
 
	}
 
	return buf;
 
}
 

	
 
#if !defined(NO_DEBUG_MESSAGES)
 

	
 
/**
 
 * Internal function for outputting the debug line.
 
 * @param dbg Debug category.
 
 * @param buf Text line to output.