mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
util: Added 'const' attribute to function parameters
This commit is contained in:
committed by
Carlos R. Mafra
parent
d44aa97243
commit
5d03c455fc
@@ -30,7 +30,7 @@ enum {
|
|||||||
CHARSET_ENCODING
|
CHARSET_ENCODING
|
||||||
};
|
};
|
||||||
|
|
||||||
static int countChar(char *str, char c)
|
static int countChar(const char *str, char c)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@@ -47,17 +47,17 @@ static int countChar(char *str, char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct str {
|
typedef struct str {
|
||||||
char *str;
|
const char *str;
|
||||||
int len;
|
int len;
|
||||||
} str;
|
} str;
|
||||||
|
|
||||||
#define XLFD_TOKENS 14
|
#define XLFD_TOKENS 14
|
||||||
|
|
||||||
static str *getXLFDTokens(char *xlfd)
|
static str *getXLFDTokens(const char *xlfd)
|
||||||
{
|
{
|
||||||
static str tokens[XLFD_TOKENS];
|
static str tokens[XLFD_TOKENS];
|
||||||
int i, len, size;
|
int i, len, size;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
/* XXX: why does this assume there can't ever be XFNextPrefix? */
|
/* XXX: why does this assume there can't ever be XFNextPrefix? */
|
||||||
if (!xlfd || *xlfd != '-' || countChar(xlfd, '-') != XLFD_TOKENS)
|
if (!xlfd || *xlfd != '-' || countChar(xlfd, '-') != XLFD_TOKENS)
|
||||||
@@ -135,7 +135,7 @@ static char *mapSlantToName(str * slant)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *xlfdToFc(char *xlfd, char *useFamily, Bool keepXLFD)
|
char *xlfdToFc(const char *xlfd, const char *useFamily, Bool keepXLFD)
|
||||||
{
|
{
|
||||||
str *tokens, *family, *weight, *slant;
|
str *tokens, *family, *weight, *slant;
|
||||||
char *name, buf[64];
|
char *name, buf[64];
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ void print_help(int print_usage, int exitval)
|
|||||||
exit(exitval);
|
exit(exitval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool isFontOption(char *option)
|
static Bool isFontOption(const char *option)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ static Bool isFontOption(char *option)
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findCopyFile(char *dir, char *file)
|
void findCopyFile(const char *dir, const char *file)
|
||||||
{
|
{
|
||||||
char *fullPath;
|
char *fullPath;
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ void findCopyFile(char *dir, char *file)
|
|||||||
free(fullPath);
|
free(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeThemePack(WMPropList * style, char *themeName)
|
void makeThemePack(WMPropList * style, const char *themeName)
|
||||||
{
|
{
|
||||||
WMPropList *keys;
|
WMPropList *keys;
|
||||||
WMPropList *key;
|
WMPropList *key;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ int ignoreCursors = 0;
|
|||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
|
|
||||||
static Bool isCursorOption(char *option)
|
static Bool isCursorOption(const char *option)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ static Bool isCursorOption(char *option)
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool isFontOption(char *option)
|
static Bool isFontOption(const char *option)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ static Bool isFontOption(char *option)
|
|||||||
* that qualifies the external references to be absolute, possibly
|
* that qualifies the external references to be absolute, possibly
|
||||||
* pending further expansion
|
* pending further expansion
|
||||||
*/
|
*/
|
||||||
void hackPathInTexture(WMPropList * texture, char *prefix)
|
void hackPathInTexture(WMPropList * texture, const char *prefix)
|
||||||
{
|
{
|
||||||
WMPropList *type;
|
WMPropList *type;
|
||||||
char *t;
|
char *t;
|
||||||
@@ -158,7 +158,7 @@ void hackPathInTexture(WMPropList * texture, char *prefix)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hackPaths(WMPropList * style, char *prefix)
|
void hackPaths(WMPropList * style, const char *prefix)
|
||||||
{
|
{
|
||||||
WMPropList *keys;
|
WMPropList *keys;
|
||||||
WMPropList *key;
|
WMPropList *key;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "wmgenmenu.h"
|
#include "wmgenmenu.h"
|
||||||
|
|
||||||
static void find_and_write(char *group, char *list[][2], int this_is_terminals);
|
static void find_and_write(const char *group, char *list[][2], int this_is_terminals);
|
||||||
static void other_window_managers(void);
|
static void other_window_managers(void);
|
||||||
static void print_help(int print_usage, int exitval);
|
static void print_help(int print_usage, int exitval);
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ int main(int argc, char *argv[])
|
|||||||
* - make sure previous menus of these levels are
|
* - make sure previous menus of these levels are
|
||||||
* attached to their parent before calling
|
* attached to their parent before calling
|
||||||
*/
|
*/
|
||||||
static void find_and_write(char *group, char *list[][2], int this_is_terminals)
|
static void find_and_write(const char *group, char *list[][2], int this_is_terminals)
|
||||||
{
|
{
|
||||||
int i, argc;
|
int i, argc;
|
||||||
char *t, **argv, buf[PATH_MAX];
|
char *t, **argv, buf[PATH_MAX];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static void assemblePLMenuFunc(WMTreeNode *aNode, void *data);
|
|||||||
static int dirParseFunc(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
static int dirParseFunc(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
||||||
static int menuSortFunc(const void *left, const void *right);
|
static int menuSortFunc(const void *left, const void *right);
|
||||||
static int nodeFindSubMenuByNameFunc(const void *item, const void *cdata);
|
static int nodeFindSubMenuByNameFunc(const void *item, const void *cdata);
|
||||||
static WMTreeNode *findPositionInMenu(char *submenu);
|
static WMTreeNode *findPositionInMenu(const char *submenu);
|
||||||
static void (*parse)(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry));
|
static void (*parse)(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry));
|
||||||
static Bool (*validateFilename)(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
static Bool (*validateFilename)(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ static int menuSortFunc(const void *left, const void *right)
|
|||||||
/* returns the leaf an entry with the submenu spec `submenu' attaches to.
|
/* returns the leaf an entry with the submenu spec `submenu' attaches to.
|
||||||
* creates `submenu' path (anchored to the root) along the way.
|
* creates `submenu' path (anchored to the root) along the way.
|
||||||
*/
|
*/
|
||||||
static WMTreeNode *findPositionInMenu(char *submenu)
|
static WMTreeNode *findPositionInMenu(const char *submenu)
|
||||||
{
|
{
|
||||||
char *q;
|
char *q;
|
||||||
WMMenuEntry *wm;
|
WMMenuEntry *wm;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef struct {
|
|||||||
} WMConfigMenuEntry;
|
} WMConfigMenuEntry;
|
||||||
|
|
||||||
static Bool wmc_to_wm(WMConfigMenuEntry **wmc, WMMenuEntry **wm);
|
static Bool wmc_to_wm(WMConfigMenuEntry **wmc, WMMenuEntry **wm);
|
||||||
static void parse_wmconfig_line(char **label, char **key, char **value, char *line);
|
static void parse_wmconfig_line(char **label, char **key, char **value, const char *line);
|
||||||
static void init_wmconfig_storage(WMConfigMenuEntry **wmc);
|
static void init_wmconfig_storage(WMConfigMenuEntry **wmc);
|
||||||
|
|
||||||
void parse_wmconfig(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry))
|
void parse_wmconfig(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry))
|
||||||
@@ -170,12 +170,12 @@ Bool wmconfig_validate_file(const char *filename, const struct stat *st, int tfl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get a line allocating label, key and value as necessary */
|
/* get a line allocating label, key and value as necessary */
|
||||||
static void parse_wmconfig_line(char **label, char **key, char **value, char *line)
|
static void parse_wmconfig_line(char **label, char **key, char **value, const char *line)
|
||||||
{
|
{
|
||||||
char *p;
|
const char *p;
|
||||||
int kstart, kend;
|
int kstart, kend;
|
||||||
|
|
||||||
p = (char *)line;
|
p = line;
|
||||||
*label = *key = *value = NULL;
|
*label = *key = *value = NULL;
|
||||||
kstart = kend = 0;
|
kstart = kend = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void initXinerama()
|
|||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
}
|
}
|
||||||
|
|
||||||
RImage *loadImage(RContext * rc, char *file)
|
RImage *loadImage(RContext * rc, const char *file)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
@@ -974,7 +974,7 @@ void helperLoop(RContext * rc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDomain(char *domain, char *key, char *texture)
|
void updateDomain(const char *domain, const char *key, const char *texture)
|
||||||
{
|
{
|
||||||
char *program = "wdwrite";
|
char *program = "wdwrite";
|
||||||
|
|
||||||
@@ -986,7 +986,7 @@ void updateDomain(char *domain, char *key, char *texture)
|
|||||||
wwarning("warning could not run \"%s\"", program);
|
wwarning("warning could not run \"%s\"", program);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WMPropList *getValueForKey(char *domain, char *keyName)
|
static WMPropList *getValueForKey(const char *domain, const char *keyName)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
WMPropList *key, *val, *d;
|
WMPropList *key, *val, *d;
|
||||||
@@ -1043,7 +1043,7 @@ static WMPropList *getValueForKey(char *domain, char *keyName)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getPixmapPath(char *domain)
|
char *getPixmapPath(const char *domain)
|
||||||
{
|
{
|
||||||
WMPropList *val;
|
WMPropList *val;
|
||||||
char *ptr, *data;
|
char *ptr, *data;
|
||||||
@@ -1094,7 +1094,7 @@ char *getPixmapPath(char *domain)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getFullPixmapPath(char *file)
|
char *getFullPixmapPath(const char *file)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
@@ -1155,7 +1155,7 @@ void print_help()
|
|||||||
puts(" -h, --help show this help and exit");
|
puts(" -h, --help show this help and exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeTextureForWorkspace(char *domain, char *texture, int workspace)
|
void changeTextureForWorkspace(const char *domain, char *texture, int workspace)
|
||||||
{
|
{
|
||||||
WMPropList *array, *val;
|
WMPropList *array, *val;
|
||||||
char *value;
|
char *value;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ Time getTimestamp(Display * dpy, Window win)
|
|||||||
return ev.xproperty.time;
|
return ev.xproperty.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fetchSelection(Display * dpy, char *selection, char *progName)
|
char *fetchSelection(Display * dpy, const char *selection, const char *progName)
|
||||||
{
|
{
|
||||||
Atom selatom = XInternAtom(dpy, selection, False);
|
Atom selatom = XInternAtom(dpy, selection, False);
|
||||||
Atom clipatom = XInternAtom(dpy, "CLIPBOARD", False);
|
Atom clipatom = XInternAtom(dpy, "CLIPBOARD", False);
|
||||||
|
|||||||
Reference in New Issue
Block a user