aboutsummaryrefslogblamecommitdiffstats
path: root/libgamma_value_of_error.c
blob: 16fc941b825d5c5b4793f0e70e542e2e215a5034 (plain) (tree)
1
2
3
4
5
6
7
8
9




                                                         
                                                                     

                                                                           
                                                            






                                                         
                     





                                  
/* See LICENSE file for copyright and license details. */
#include "common.h"


/**
 * Get the value of a `libgamma` error definition referred to by name
 * 
 * @param   name  The name of the definition associated with the error code
 * @return        The error code, zero if the name is `NULL`
 *                or does not refer to a `libgamma` error
 */
int
libgamma_value_of_error(const char *name)
{
	if (!name)
		return 0;
#define X(NAME, ...)\
	if (!strcmp(name, #NAME))\
		return NAME;
	LIST_ERRORS(X)
	#undef X
	return 0;
}