aboutsummaryrefslogblamecommitdiffstats
path: root/libgamma_value_of_method.c
blob: 7015453b30c97030a67086a4ad36da1ebef6969c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                                
                            




                                    
                      






                                     
#include "common.h"


/**
 * Get the value of an adjustment method
 * 
 * @param   method  The name of the adjustment method, for example
 *                  "randr" or "LIBGAMMA_METHOD_X_RANDR"
 * @return          The adjustment method; for example `LIBGAMMA_METHOD_X_RANDR`
 *                  for "randr" and "LIBGAMMA_METHOD_X_RANDR"
 */
int
libgamma_value_of_method(const char *method)
{
#define X(CONST, NAME, ...)\
	if (!strcmp(method, #NAME))\
		return CONST;
	LIST_METHODS(X)
#undef X

#define X(CONST, ...)\
	if (!strcmp(method, #CONST))\
		return CONST;
	LIST_METHODS(X)
#undef X

	return 0;
}