daemon: ladish_app_supervisor_check_app_name()
ladish_app_supervisor_find_app_by_name() was not really useful because name can change. Apps should be searched by their unqiue dbus id instead.
This commit is contained in:
parent
04086f1fef
commit
e913955b1d
|
@ -169,7 +169,7 @@ const char * ladish_app_supervisor_get_opath(ladish_app_supervisor_handle superv
|
|||
return supervisor_ptr->opath;
|
||||
}
|
||||
|
||||
ladish_app_handle ladish_app_supervisor_find_app_by_name(ladish_app_supervisor_handle supervisor_handle, const char * name)
|
||||
bool ladish_app_supervisor_check_app_name(ladish_app_supervisor_handle supervisor_handle, const char * name)
|
||||
{
|
||||
struct list_head * node_ptr;
|
||||
struct ladish_app * app_ptr;
|
||||
|
@ -179,11 +179,11 @@ ladish_app_handle ladish_app_supervisor_find_app_by_name(ladish_app_supervisor_h
|
|||
app_ptr = list_entry(node_ptr, struct ladish_app, siblings);
|
||||
if (strcmp(app_ptr->name, name) == 0)
|
||||
{
|
||||
return (ladish_app_handle)app_ptr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
ladish_app_handle ladish_app_supervisor_find_app_by_id(ladish_app_supervisor_handle supervisor_handle, uint64_t id)
|
||||
|
|
|
@ -213,16 +213,15 @@ const char * ladish_app_supervisor_get_name(ladish_app_supervisor_handle supervi
|
|||
unsigned int ladish_app_supervisor_get_running_app_count(ladish_app_supervisor_handle supervisor_handle);
|
||||
|
||||
/**
|
||||
* Find app by name
|
||||
*
|
||||
* TODO: ladish_app_supervisor_check_app_name() should be created and exported instead
|
||||
* Check whether app with name supplied name exists
|
||||
*
|
||||
* @param[in] supervisor_handle supervisor object handle
|
||||
* @param[in] name name of the app to search for
|
||||
*
|
||||
* @return app handle on success; NULL if app is not found; the app handle is owned by the app supervisor object
|
||||
* @retval true app with supplied name exists
|
||||
* @retval false app with supplied name does not exist
|
||||
*/
|
||||
ladish_app_handle ladish_app_supervisor_find_app_by_name(ladish_app_supervisor_handle supervisor_handle, const char * name);
|
||||
bool ladish_app_supervisor_check_app_name(ladish_app_supervisor_handle supervisor_handle, const char * name);
|
||||
|
||||
/**
|
||||
* Find app by id (as exposed through the D-Bus interface)
|
||||
|
|
|
@ -118,7 +118,7 @@ static bool run(void * context)
|
|||
|
||||
/* make the app name unique */
|
||||
index = 2;
|
||||
while (ladish_app_supervisor_find_app_by_name(supervisor, name) != NULL)
|
||||
while (ladish_app_supervisor_check_app_name(supervisor, name))
|
||||
{
|
||||
sprintf(end, "-%u", index);
|
||||
index++;
|
||||
|
|
Loading…
Reference in New Issue