mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
[util] Add name_func_rlookup()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8bba0ba76a
commit
ff8603110a
2 changed files with 24 additions and 4 deletions
|
@ -78,10 +78,10 @@ compute_new_value_from_arg(const char *arg, double current_value)
|
|||
}
|
||||
|
||||
/** Lookup for a function pointer from its name
|
||||
* in the given name_func_link_t list
|
||||
* \param funcname Function name
|
||||
* \param list Function and name link list
|
||||
* \return function pointer
|
||||
* in the given name_func_link_t list.
|
||||
* \param funcname Function name.
|
||||
* \param list Function and name link list.
|
||||
* \return Function pointer.
|
||||
*/
|
||||
void *
|
||||
name_func_lookup(const char *funcname, const name_func_link_t *list)
|
||||
|
@ -96,6 +96,25 @@ name_func_lookup(const char *funcname, const name_func_link_t *list)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/** Lookup for a function name from its pointer
|
||||
* in the given name_func_link_t list.
|
||||
* \param funcp Function pointer.
|
||||
* \param list Function and name link list.
|
||||
* \return Name of the function.
|
||||
*/
|
||||
const char *
|
||||
name_func_rlookup(void * funcp, const name_func_link_t *list)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(funcp && list)
|
||||
for(i = 0; list[i].name; i++)
|
||||
if(funcp == list[i].func)
|
||||
return list[i].name;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
position_t
|
||||
position_get_from_str(const char *pos)
|
||||
{
|
||||
|
|
|
@ -284,6 +284,7 @@ char * position_to_str(position_t);
|
|||
fuzzy_t fuzzy_get_from_str(const char *);
|
||||
double compute_new_value_from_arg(const char *, double);
|
||||
void *name_func_lookup(const char *, const name_func_link_t *);
|
||||
const char * name_func_rlookup(void *, const name_func_link_t *);
|
||||
void a_exec(const char *);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue