[util] Add name_func_rlookup()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8bba0ba76a
commit
ff8603110a
|
@ -78,10 +78,10 @@ compute_new_value_from_arg(const char *arg, double current_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Lookup for a function pointer from its name
|
/** Lookup for a function pointer from its name
|
||||||
* in the given name_func_link_t list
|
* in the given name_func_link_t list.
|
||||||
* \param funcname Function name
|
* \param funcname Function name.
|
||||||
* \param list Function and name link list
|
* \param list Function and name link list.
|
||||||
* \return function pointer
|
* \return Function pointer.
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
name_func_lookup(const char *funcname, const name_func_link_t *list)
|
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;
|
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_t
|
||||||
position_get_from_str(const char *pos)
|
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 *);
|
fuzzy_t fuzzy_get_from_str(const char *);
|
||||||
double compute_new_value_from_arg(const char *, double);
|
double compute_new_value_from_arg(const char *, double);
|
||||||
void *name_func_lookup(const char *, const name_func_link_t *);
|
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 *);
|
void a_exec(const char *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue