mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-25 16:55:47 +01:00
Use pointers as parameters instead of pointer-to-pointers.
Some functions expected pointers-to-pointers where pointers would do. Changed them to use pointers. Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
committed by
Carlos R. Mafra
parent
6a044fe5ae
commit
6734646265
@@ -75,9 +75,9 @@ static void getLocalizedStringValue(char **target, const char *line, int *match
|
|||||||
static int getBooleanValue(const char *line);
|
static int getBooleanValue(const char *line);
|
||||||
static void getMenuHierarchyFor(char **xdgmenuspec);
|
static void getMenuHierarchyFor(char **xdgmenuspec);
|
||||||
static int compare_matchlevel(int *current_level, const char *found_locale);
|
static int compare_matchlevel(int *current_level, const char *found_locale);
|
||||||
static Bool xdg_to_wm(XDGMenuEntry **xdg, WMMenuEntry **wmentry);
|
static Bool xdg_to_wm(XDGMenuEntry *xdg, WMMenuEntry *wmentry);
|
||||||
static void init_xdg_storage(XDGMenuEntry **xdg);
|
static void init_xdg_storage(XDGMenuEntry *xdg);
|
||||||
static void init_wm_storage(WMMenuEntry **wm);
|
static void init_wm_storage(WMMenuEntry *wm);
|
||||||
|
|
||||||
|
|
||||||
void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
||||||
@@ -123,11 +123,11 @@ void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
|||||||
/* if currently processing a group, we've just hit the
|
/* if currently processing a group, we've just hit the
|
||||||
* end of its definition, try processing it
|
* end of its definition, try processing it
|
||||||
*/
|
*/
|
||||||
if (InGroup && xdg_to_wm(&xdg, &wm)) {
|
if (InGroup && xdg_to_wm(xdg, wm)) {
|
||||||
(*addWMMenuEntryCallback)(wm);
|
(*addWMMenuEntryCallback)(wm);
|
||||||
}
|
}
|
||||||
init_xdg_storage(&xdg);
|
init_xdg_storage(xdg);
|
||||||
init_wm_storage(&wm);
|
init_wm_storage(wm);
|
||||||
InGroup = 1;
|
InGroup = 1;
|
||||||
/* start processing group */
|
/* start processing group */
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
@@ -190,7 +190,7 @@ void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
|||||||
/* at the end of the file, might as well try to menuize what we have
|
/* at the end of the file, might as well try to menuize what we have
|
||||||
* unless there was no group at all or it was marked as hidden
|
* unless there was no group at all or it was marked as hidden
|
||||||
*/
|
*/
|
||||||
if (InGroup && xdg_to_wm(&xdg, &wm))
|
if (InGroup && xdg_to_wm(xdg, wm))
|
||||||
(*addWMMenuEntryCallback)(wm);
|
(*addWMMenuEntryCallback)(wm);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -198,72 +198,72 @@ void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
|||||||
|
|
||||||
/* coerce an xdg entry type into a wm entry type
|
/* coerce an xdg entry type into a wm entry type
|
||||||
*/
|
*/
|
||||||
static Bool xdg_to_wm(XDGMenuEntry **xdg, WMMenuEntry **wm)
|
static Bool xdg_to_wm(XDGMenuEntry *xdg, WMMenuEntry *wm)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
/* Exec or TryExec is mandatory */
|
/* Exec or TryExec is mandatory */
|
||||||
if (!((*xdg)->Exec || (*xdg)->TryExec))
|
if (!(xdg->Exec || xdg->TryExec))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
/* if there's no Name, use the first word of Exec or TryExec
|
/* if there's no Name, use the first word of Exec or TryExec
|
||||||
*/
|
*/
|
||||||
if ((*xdg)->Name) {
|
if (xdg->Name) {
|
||||||
(*wm)->Name = (*xdg)->Name;
|
wm->Name = xdg->Name;
|
||||||
} else {
|
} else {
|
||||||
if ((*xdg)->Exec)
|
if (xdg->Exec)
|
||||||
(*wm)->Name = wstrdup((*xdg)->Exec);
|
wm->Name = wstrdup(xdg->Exec);
|
||||||
else /* (*xdg)->TryExec */
|
else /* xdg->TryExec */
|
||||||
(*wm)->Name = wstrdup((*xdg)->TryExec);
|
wm->Name = wstrdup(xdg->TryExec);
|
||||||
|
|
||||||
p = strchr((*wm)->Name, ' ');
|
p = strchr(wm->Name, ' ');
|
||||||
if (p)
|
if (p)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*xdg)->Exec)
|
if (xdg->Exec)
|
||||||
(*wm)->CmdLine = (*xdg)->Exec;
|
wm->CmdLine = xdg->Exec;
|
||||||
else /* (*xdg)->TryExec */
|
else /* xdg->TryExec */
|
||||||
(*wm)->CmdLine = (*xdg)->TryExec;
|
wm->CmdLine = xdg->TryExec;
|
||||||
|
|
||||||
(*wm)->SubMenu = (*xdg)->Category;
|
wm->SubMenu = xdg->Category;
|
||||||
(*wm)->Flags = (*xdg)->Flags;
|
wm->Flags = xdg->Flags;
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (re-)initialize a XDGMenuEntry storage
|
/* (re-)initialize a XDGMenuEntry storage
|
||||||
*/
|
*/
|
||||||
static void init_xdg_storage(XDGMenuEntry **xdg)
|
static void init_xdg_storage(XDGMenuEntry *xdg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((*xdg)->Name)
|
if (xdg->Name)
|
||||||
wfree((*xdg)->Name);
|
wfree(xdg->Name);
|
||||||
if ((*xdg)->TryExec)
|
if (xdg->TryExec)
|
||||||
wfree((*xdg)->TryExec);
|
wfree(xdg->TryExec);
|
||||||
if ((*xdg)->Exec)
|
if (xdg->Exec)
|
||||||
wfree((*xdg)->Exec);
|
wfree(xdg->Exec);
|
||||||
if ((*xdg)->Category)
|
if (xdg->Category)
|
||||||
wfree((*xdg)->Category);
|
wfree(xdg->Category);
|
||||||
if ((*xdg)->Path)
|
if (xdg->Path)
|
||||||
wfree((*xdg)->Path);
|
wfree(xdg->Path);
|
||||||
|
|
||||||
(*xdg)->Name = NULL;
|
xdg->Name = NULL;
|
||||||
(*xdg)->TryExec = NULL;
|
xdg->TryExec = NULL;
|
||||||
(*xdg)->Exec = NULL;
|
xdg->Exec = NULL;
|
||||||
(*xdg)->Category = NULL;
|
xdg->Category = NULL;
|
||||||
(*xdg)->Path = NULL;
|
xdg->Path = NULL;
|
||||||
(*xdg)->Flags = 0;
|
xdg->Flags = 0;
|
||||||
(*xdg)->MatchLevel = -1;
|
xdg->MatchLevel = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (re-)initialize a WMMenuEntry storage
|
/* (re-)initialize a WMMenuEntry storage
|
||||||
*/
|
*/
|
||||||
static void init_wm_storage(WMMenuEntry **wm)
|
static void init_wm_storage(WMMenuEntry *wm)
|
||||||
{
|
{
|
||||||
(*wm)->Name = NULL;
|
wm->Name = NULL;
|
||||||
(*wm)->CmdLine = NULL;
|
wm->CmdLine = NULL;
|
||||||
(*wm)->Flags = 0;
|
wm->Flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get a key from line. allocates target, which must be wfreed later */
|
/* get a key from line. allocates target, which must be wfreed later */
|
||||||
|
|||||||
Reference in New Issue
Block a user