1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-10 15:54:17 +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:
Jeremy Sowden
2019-06-20 21:23:51 +01:00
committed by Carlos R. Mafra
parent 6a044fe5ae
commit 6734646265

View File

@@ -75,9 +75,9 @@ static void getLocalizedStringValue(char **target, const char *line, int *match
static int getBooleanValue(const char *line);
static void getMenuHierarchyFor(char **xdgmenuspec);
static int compare_matchlevel(int *current_level, const char *found_locale);
static Bool xdg_to_wm(XDGMenuEntry **xdg, WMMenuEntry **wmentry);
static void init_xdg_storage(XDGMenuEntry **xdg);
static void init_wm_storage(WMMenuEntry **wm);
static Bool xdg_to_wm(XDGMenuEntry *xdg, WMMenuEntry *wmentry);
static void init_xdg_storage(XDGMenuEntry *xdg);
static void init_wm_storage(WMMenuEntry *wm);
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
* end of its definition, try processing it
*/
if (InGroup && xdg_to_wm(&xdg, &wm)) {
if (InGroup && xdg_to_wm(xdg, wm)) {
(*addWMMenuEntryCallback)(wm);
}
init_xdg_storage(&xdg);
init_wm_storage(&wm);
init_xdg_storage(xdg);
init_wm_storage(wm);
InGroup = 1;
/* start processing group */
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
* 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);
}
@@ -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
*/
static Bool xdg_to_wm(XDGMenuEntry **xdg, WMMenuEntry **wm)
static Bool xdg_to_wm(XDGMenuEntry *xdg, WMMenuEntry *wm)
{
char *p;
/* Exec or TryExec is mandatory */
if (!((*xdg)->Exec || (*xdg)->TryExec))
if (!(xdg->Exec || xdg->TryExec))
return False;
/* if there's no Name, use the first word of Exec or TryExec
*/
if ((*xdg)->Name) {
(*wm)->Name = (*xdg)->Name;
if (xdg->Name) {
wm->Name = xdg->Name;
} else {
if ((*xdg)->Exec)
(*wm)->Name = wstrdup((*xdg)->Exec);
else /* (*xdg)->TryExec */
(*wm)->Name = wstrdup((*xdg)->TryExec);
if (xdg->Exec)
wm->Name = wstrdup(xdg->Exec);
else /* xdg->TryExec */
wm->Name = wstrdup(xdg->TryExec);
p = strchr((*wm)->Name, ' ');
p = strchr(wm->Name, ' ');
if (p)
*p = '\0';
}
if ((*xdg)->Exec)
(*wm)->CmdLine = (*xdg)->Exec;
else /* (*xdg)->TryExec */
(*wm)->CmdLine = (*xdg)->TryExec;
if (xdg->Exec)
wm->CmdLine = xdg->Exec;
else /* xdg->TryExec */
wm->CmdLine = xdg->TryExec;
(*wm)->SubMenu = (*xdg)->Category;
(*wm)->Flags = (*xdg)->Flags;
wm->SubMenu = xdg->Category;
wm->Flags = xdg->Flags;
return True;
}
/* (re-)initialize a XDGMenuEntry storage
*/
static void init_xdg_storage(XDGMenuEntry **xdg)
static void init_xdg_storage(XDGMenuEntry *xdg)
{
if ((*xdg)->Name)
wfree((*xdg)->Name);
if ((*xdg)->TryExec)
wfree((*xdg)->TryExec);
if ((*xdg)->Exec)
wfree((*xdg)->Exec);
if ((*xdg)->Category)
wfree((*xdg)->Category);
if ((*xdg)->Path)
wfree((*xdg)->Path);
if (xdg->Name)
wfree(xdg->Name);
if (xdg->TryExec)
wfree(xdg->TryExec);
if (xdg->Exec)
wfree(xdg->Exec);
if (xdg->Category)
wfree(xdg->Category);
if (xdg->Path)
wfree(xdg->Path);
(*xdg)->Name = NULL;
(*xdg)->TryExec = NULL;
(*xdg)->Exec = NULL;
(*xdg)->Category = NULL;
(*xdg)->Path = NULL;
(*xdg)->Flags = 0;
(*xdg)->MatchLevel = -1;
xdg->Name = NULL;
xdg->TryExec = NULL;
xdg->Exec = NULL;
xdg->Category = NULL;
xdg->Path = NULL;
xdg->Flags = 0;
xdg->MatchLevel = -1;
}
/* (re-)initialize a WMMenuEntry storage
*/
static void init_wm_storage(WMMenuEntry **wm)
static void init_wm_storage(WMMenuEntry *wm)
{
(*wm)->Name = NULL;
(*wm)->CmdLine = NULL;
(*wm)->Flags = 0;
wm->Name = NULL;
wm->CmdLine = NULL;
wm->Flags = 0;
}
/* get a key from line. allocates target, which must be wfreed later */