Attached patch silences some warnings. All are harmless but having them
silent makes it easier to spot similar ones and makes lives easier for
people with the habit of giving many -W things in CFLAGS.
Types of warnings this fixes:
* shadowed symbols: often variables are names after global variables or
system functions. While being totally harmless in itself, this can cause
one to miss issues when moving code around.
(things like variables called "dup", "index" or (ratpoison-specific)
"command" or "gv").
* unsigned char vs char pointers
(there is always the danger of actually inserting new ones by this,
but I think the changes in the patch only make things better).
* unused parameters
functions that are given as callbacks or into function pointers often
do not use all their parameters which gcc complains about in -Wunused
which is enables by default in -Wextra. Against this this adds an
UNUSED macro that tells gcc to shut up.
(special case in linkedlist.*, here the patch replaces the prefetch with
and gcc builtin on newer gccs).
* "uninitialized" variable
glibc has an inline strtok_r, which causes due to some gcc bug to
some uninitialized value warning. As the "= NULL" hides nothing here,
I just added it.
* empty if or else branches
as PRINT_DEBUG is sometimes empty, gcc warns about empty if and else
braches. With some { } that stops (though other compilers might warn
more). But I think this way it is "safest" to have no ugly effects
(not that the danger was more than insignificant before)...
If requested, I can also supply only a subset of those.
Hochachtungsvoll,
Bernhard R. Link
diff --git a/src/actions.c b/src/actions.c
index da14648..e2bd629 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -549,19 +549,19 @@ find_command_by_keydesc (char *desc, rp_keymap *map)
static char *
resolve_command_from_keydesc (char *desc, int depth, rp_keymap *map)
{
- char *cmd, *command;
+ char *cmd, *c;
- command = find_command_by_keydesc (desc, map);
- if (!command)
+ c = find_command_by_keydesc (desc, map);
+ if (!c)
return NULL;
/* is it a link? */
- if (strncmp (command, "link", 4) || depth > MAX_LINK_DEPTH)
+ if (strncmp (c, "link", 4) || depth > MAX_LINK_DEPTH)
/* it is not */
- return command;
+ return c;
- cmd = resolve_command_from_keydesc (&command[5], depth + 1, map);
- return (cmd != NULL) ? cmd : command;
+ cmd = resolve_command_from_keydesc (&c[5], depth + 1, map);
+ return (cmd != NULL) ? cmd : c;
}
@@ -673,14 +673,14 @@ find_alias_index (char *name)
static void
add_alias (char *name, char *alias)
{
- int index;
+ int i;
/* Are we updating an existing alias, or creating a new one? */
- index = find_alias_index (name);
- if (index >= 0)
+ i = find_alias_index (name);
+ if (i >= 0)
{
- free (alias_list[index].alias);
- alias_list[index].alias = xstrdup (alias);
+ free (alias_list[i].alias);
+ alias_list[i].alias = xstrdup (alias);
}
else
{
@@ -1053,14 +1053,14 @@ cmd_unmanage (int interactive, struct cmdarg **args)
/* Clear the unmanaged window list */
cmdret *
-cmd_clrunmanaged (int interactive, struct cmdarg **args)
+cmd_clrunmanaged (int interactive UNUSED, struct cmdarg **args UNUSED)
{
clear_unmanaged_list();
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_undefinekey (int interactive, struct cmdarg **args)
+cmd_undefinekey (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret = NULL;
rp_keymap *map;
@@ -1090,7 +1090,7 @@ cmd_undefinekey (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_definekey (int interactive, struct cmdarg **args)
+cmd_definekey (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret = NULL;
rp_keymap *map;
@@ -1124,13 +1124,13 @@ cmd_definekey (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_unimplemented (int interactive, struct cmdarg **args)
+cmd_unimplemented (int interactive UNUSED, struct cmdarg **args UNUSED)
{
return cmdret_new (RET_FAILURE, "FIXME: unimplemented command");
}
cmdret *
-cmd_source (int interactive, struct cmdarg **args)
+cmd_source (int interactive UNUSED, struct cmdarg **args)
{
FILE *fileptr;
@@ -1147,7 +1147,7 @@ cmd_source (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_meta (int interactive, struct cmdarg **args)
+cmd_meta (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret = NULL;
struct rp_key key;
@@ -1185,7 +1185,7 @@ cmd_meta (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_prev (int interactive, struct cmdarg **args)
+cmd_prev (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_window *cur, *win;
cur = current_window();
@@ -1202,7 +1202,7 @@ cmd_prev (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_prev_frame (int interactive, struct cmdarg **args)
+cmd_prev_frame (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -1216,7 +1216,7 @@ cmd_prev_frame (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_next (int interactive, struct cmdarg **args)
+cmd_next (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_window *cur, *win;
cur = current_window();
@@ -1233,7 +1233,7 @@ cmd_next (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_next_frame (int interactive, struct cmdarg **args)
+cmd_next_frame (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -1247,7 +1247,7 @@ cmd_next_frame (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_other (int interactive, struct cmdarg **args)
+cmd_other (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_window *w;
@@ -1279,7 +1279,7 @@ string_to_window_number (char *str)
}
static struct list_head *
-trivial_completions (char* str)
+trivial_completions (char* str UNUSED)
{
struct list_head *list;
@@ -1291,7 +1291,7 @@ trivial_completions (char* str)
}
static struct list_head *
-keymap_completions (char* str)
+keymap_completions (char* str UNUSED)
{
rp_keymap *cur;
struct list_head *list;
@@ -1313,7 +1313,7 @@ keymap_completions (char* str)
}
static struct list_head *
-window_completions (char* str)
+window_completions (char* str UNUSED)
{
rp_window_elem *cur;
struct list_head *list;
@@ -1337,7 +1337,7 @@ window_completions (char* str)
/* switch to window number or name */
cmdret *
-cmd_select (int interactive, struct cmdarg **args)
+cmd_select (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret = NULL;
char *str;
@@ -1394,7 +1394,7 @@ cmd_select (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_rename (int interactive, struct cmdarg **args)
+cmd_rename (int interactive UNUSED, struct cmdarg **args)
{
if (current_window() == NULL)
return cmdret_new (RET_FAILURE, NULL);
@@ -1410,7 +1410,7 @@ cmd_rename (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_delete (int interactive, struct cmdarg **args)
+cmd_delete (int interactive UNUSED, struct cmdarg **args UNUSED)
{
XEvent ev;
int status;
@@ -1426,14 +1426,15 @@ cmd_delete (int interactive, struct cmdarg **args)
ev.xclient.data.l[1] = CurrentTime;
status = XSendEvent(dpy, current_window()->w, False, 0, &ev);
- if (status == 0)
+ if (status == 0) {
PRINT_DEBUG (("Delete window failed\n"));
+ }
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_kill (int interactive, struct cmdarg **args)
+cmd_kill (int interactive UNUSED, struct cmdarg **args UNUSED)
{
if (current_window() == NULL)
return cmdret_new (RET_FAILURE, NULL);
@@ -1444,7 +1445,7 @@ cmd_kill (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_version (int interactive, struct cmdarg **args)
+cmd_version (int interactive UNUSED, struct cmdarg **args UNUSED)
{
return cmdret_new (RET_SUCCESS, "%s", PACKAGE " " VERSION " (built " __DATE__ " " __TIME__ ")");
}
@@ -1564,7 +1565,7 @@ read_keydesc (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
}
static struct list_head *
-group_completions (char *str)
+group_completions (char *str UNUSED)
{
struct list_head *list;
rp_group *cur;
@@ -1597,7 +1598,7 @@ group_completions (char *str)
}
static struct list_head *
-colon_completions (char* str)
+colon_completions (char* str UNUSED)
{
int i;
struct user_command *uc;
@@ -1707,17 +1708,17 @@ read_shellcmd (struct argspec *spec, struct sbuf *s, struct cmdarg **arg, const
ret = read_string (spec, s, hist_SHELLCMD, exec_completions, arg);
if (command_name && !ret) {
/* store for command history */
- char *s = xmalloc (strlen(command_name) + strlen((*arg)->string) + 2);
- sprintf (s, "%s %s", command_name, (*arg)->string);
- history_add (hist_COMMAND, s);
- free(s);
+ char *str = xmalloc (strlen(command_name) + strlen((*arg)->string) + 2);
+ sprintf (str, "%s %s", command_name, (*arg)->string);
+ history_add (hist_COMMAND, str);
+ free(str);
}
return ret;
}
/* Return NULL on abort/failure. */
static cmdret *
-read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
+read_frame (struct argspec *spec UNUSED, struct sbuf *s, struct cmdarg **arg)
{
rp_frame *frame;
int fnum = -1;
@@ -1744,14 +1745,14 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
for (j=0; j<num_screens; j++)
{
XSetWindowAttributes attr;
- rp_screen *s = &screens[j];
+ rp_screen *screen = &screens[j];
/* Set up the window attributes to be used in the loop. */
- attr.border_pixel = s->fg_color;
- attr.background_pixel = s->bg_color;
+ attr.border_pixel = screen->fg_color;
+ attr.background_pixel = screen->bg_color;
attr.override_redirect = True;
- list_for_each_entry (cur, &s->frames, node)
+ list_for_each_entry (cur, &screen->frames, node)
{
int width, height;
char *num;
@@ -1760,11 +1761,11 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
determine the height and width of the window. */
/* num = xsprintf (" %d ", cur->number); */
num = frame_selector (cur->number);
- width = defaults.bar_x_padding * 2 + rp_text_width (s, defaults.font, num, -1);
- height = (FONT_HEIGHT (s) + defaults.bar_y_padding * 2);
+ width = defaults.bar_x_padding * 2 + rp_text_width (screen, defaults.font, num, -1);
+ height = (FONT_HEIGHT (screen) + defaults.bar_y_padding * 2);
/* Create and map the window. */
- wins[i] = XCreateWindow (dpy, s->root, s->left + cur->x, s->top + cur->y, width, height, 1,
+ wins[i] = XCreateWindow (dpy, screen->root, screen->left + cur->x, screen->top + cur->y, width, height, 1,
CopyFromParent, CopyFromParent, CopyFromParent,
CWOverrideRedirect | CWBorderPixel | CWBackPixel,
&attr);
@@ -1772,9 +1773,9 @@ read_frame (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
XClearWindow (dpy, wins[i]);
/* Display the frame's number inside the window. */
- rp_draw_string (s, wins[i], s->normal_gc,
+ rp_draw_string (screen, wins[i], screen->normal_gc,
defaults.bar_x_padding,
- defaults.bar_y_padding + FONT_ASCENT(s),
+ defaults.bar_y_padding + FONT_ASCENT(screen),
num, -1);
free (num);
@@ -1990,7 +1991,7 @@ read_group (struct argspec *spec, struct sbuf *s, struct cmdarg **arg)
}
static struct list_head *
-hook_completions (char* str)
+hook_completions (char* str UNUSED)
{
struct list_head *list;
struct rp_hook_db_entry *entry;
@@ -2058,7 +2059,7 @@ find_variable (char *str)
}
static struct list_head *
-var_completions (char *str)
+var_completions (char *str UNUSED)
{
struct list_head *list;
struct set_var *cur;
@@ -2478,7 +2479,7 @@ command (int interactive, char *data)
struct cmdarg *acur;
struct list_head *iter, *tmp;
struct list_head head, args;
- int i, nargs = 0, raw = 0;
+ int nargs = 0, raw = 0;
INIT_LIST_HEAD (&args);
INIT_LIST_HEAD (&head);
@@ -2550,7 +2551,7 @@ command (int interactive, char *data)
}
cmdret *
-cmd_colon (int interactive, struct cmdarg **args)
+cmd_colon (int interactive UNUSED, struct cmdarg **args)
{
cmdret *result;
char *input;
@@ -2571,21 +2572,21 @@ cmd_colon (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_exec (int interactive, struct cmdarg **args)
+cmd_exec (int interactive UNUSED, struct cmdarg **args)
{
spawn (ARG_STRING(0), 0, current_frame());
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_execa (int interactive, struct cmdarg **args)
+cmd_execa (int interactive UNUSED, struct cmdarg **args)
{
spawn (ARG_STRING(0), 0, NULL);
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_execf (int interactive, struct cmdarg **args)
+cmd_execf (int interactive UNUSED, struct cmdarg **args)
{
spawn (ARG_STRING(1), 0, ARG(0,frame));
return cmdret_new (RET_SUCCESS, NULL);
@@ -2639,7 +2640,7 @@ spawn(char *cmd, int raw, rp_frame *frame)
/* Switch to a different Window Manager. Thanks to
"Chr. v. Stuckrad" <[email protected]> for the patch. */
cmdret *
-cmd_newwm(int interactive, struct cmdarg **args)
+cmd_newwm(int interactive UNUSED, struct cmdarg **args)
{
/* in the event loop, this will switch WMs. */
rp_exec_newwm = xstrdup (ARG_STRING(0));
@@ -2648,7 +2649,7 @@ cmd_newwm(int interactive, struct cmdarg **args)
}
cmdret *
-cmd_quit(int interactive, struct cmdarg **args)
+cmd_quit(int interactive UNUSED, struct cmdarg **args UNUSED)
{
kill_signalled = 1;
return cmdret_new (RET_SUCCESS, NULL);
@@ -2658,7 +2659,7 @@ cmd_quit(int interactive, struct cmdarg **args)
<[email protected]> for the patch. Thanks to Jonathan Walther
<[email protected]> for making it pretty. */
cmdret *
-cmd_time (int interactive, struct cmdarg **args)
+cmd_time (int interactive UNUSED, struct cmdarg **args UNUSED)
{
char *msg, *tmp;
time_t timep;
@@ -2678,7 +2679,7 @@ cmd_time (int interactive, struct cmdarg **args)
/* Assign a new number to a window ala screen's number command. */
cmdret *
-cmd_number (int interactive, struct cmdarg **args)
+cmd_number (int interactive UNUSED, struct cmdarg **args)
{
int old_number, new_number;
rp_window_elem *other_win, *win;
@@ -2768,14 +2769,14 @@ cmd_windows (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_abort (int interactive, struct cmdarg **args)
+cmd_abort (int interactive UNUSED, struct cmdarg **args UNUSED)
{
return cmdret_new (RET_SUCCESS, NULL);
}
/* Redisplay the current window by sending 2 resize events. */
cmdret *
-cmd_redisplay (int interactive, struct cmdarg **args)
+cmd_redisplay (int interactive UNUSED, struct cmdarg **args UNUSED)
{
force_maximize (current_window());
return cmdret_new (RET_SUCCESS, NULL);
@@ -2783,7 +2784,7 @@ cmd_redisplay (int interactive, struct cmdarg **args)
/* Reassign the prefix key. */
cmdret *
-cmd_escape (int interactive, struct cmdarg **args)
+cmd_escape (int interactive UNUSED, struct cmdarg **args)
{
struct rp_key *key;
rp_action *action;
@@ -2834,7 +2835,7 @@ cmd_escape (int interactive, struct cmdarg **args)
/* User accessible call to display the passed in string. */
cmdret *
-cmd_echo (int interactive, struct cmdarg **args)
+cmd_echo (int interactive UNUSED, struct cmdarg **args)
{
marked_message_printf (0, 0, "%s", ARG_STRING(0));
@@ -2866,7 +2867,7 @@ read_split (char *str, int max, int *p)
}
cmdret *
-cmd_v_split (int interactive, struct cmdarg **args)
+cmd_v_split (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret;
rp_frame *frame;
@@ -2894,7 +2895,7 @@ cmd_v_split (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_h_split (int interactive, struct cmdarg **args)
+cmd_h_split (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret;
rp_frame *frame;
@@ -2922,7 +2923,7 @@ cmd_h_split (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_only (int interactive, struct cmdarg **args)
+cmd_only (int interactive UNUSED, struct cmdarg **args UNUSED)
{
push_frame_undo (current_screen()); /* fdump to stack */
remove_all_splits();
@@ -2932,7 +2933,7 @@ cmd_only (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_remove (int interactive, struct cmdarg **args)
+cmd_remove (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s = current_screen();
rp_frame *frame;
@@ -2957,7 +2958,7 @@ cmd_remove (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_shrink (int interactive, struct cmdarg **args)
+cmd_shrink (int interactive UNUSED, struct cmdarg **args UNUSED)
{
push_frame_undo (current_screen()); /* fdump to stack */
resize_shrink_to_window (current_frame());
@@ -3106,7 +3107,7 @@ set_resizeunit (struct cmdarg **args)
/* banish the rat pointer */
cmdret *
-cmd_banish (int interactive, struct cmdarg **args)
+cmd_banish (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s;
@@ -3117,7 +3118,7 @@ cmd_banish (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_banishrel (int interactive, struct cmdarg **args)
+cmd_banishrel (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s = current_screen();
rp_window *w = current_window();
@@ -3132,7 +3133,7 @@ cmd_banishrel (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_ratinfo (int interactive, struct cmdarg **args)
+cmd_ratinfo (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s;
Window root_win, child_win;
@@ -3146,7 +3147,7 @@ cmd_ratinfo (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_ratrelinfo (int interactive, struct cmdarg **args)
+cmd_ratrelinfo (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s;
rp_window *rpw;
@@ -3172,7 +3173,7 @@ cmd_ratrelinfo (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_ratwarp (int interactive, struct cmdarg **args)
+cmd_ratwarp (int interactive UNUSED, struct cmdarg **args)
{
rp_screen *s;
@@ -3182,7 +3183,7 @@ cmd_ratwarp (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_ratrelwarp (int interactive, struct cmdarg **args)
+cmd_ratrelwarp (int interactive UNUSED, struct cmdarg **args)
{
rp_screen *s;
@@ -3192,7 +3193,7 @@ cmd_ratrelwarp (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_ratclick (int interactive, struct cmdarg **args)
+cmd_ratclick (int interactive UNUSED, struct cmdarg **args)
{
int button = 1;
@@ -3213,7 +3214,7 @@ cmd_ratclick (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_rathold (int interactive, struct cmdarg **args)
+cmd_rathold (int interactive UNUSED, struct cmdarg **args)
{
int button = 1;
@@ -3239,7 +3240,7 @@ cmd_rathold (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_curframe (int interactive, struct cmdarg **args)
+cmd_curframe (int interactive, struct cmdarg **args UNUSED)
{
if (interactive)
{
@@ -3253,7 +3254,7 @@ cmd_curframe (int interactive, struct cmdarg **args)
/* Thanks to Martin Samuelsson <[email protected]> for the
original patch. */
cmdret *
-cmd_license (int interactive, struct cmdarg **args)
+cmd_license (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_screen *s = current_screen();
int x = 10;
@@ -3494,7 +3495,7 @@ cmd_help (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_rudeness (int interactive, struct cmdarg **args)
+cmd_rudeness (int interactive UNUSED, struct cmdarg **args)
{
int num;
@@ -3547,7 +3548,7 @@ wingravity_to_string (int g)
}
cmdret *
-cmd_gravity (int interactive, struct cmdarg **args)
+cmd_gravity (int interactive UNUSED, struct cmdarg **args)
{
int gravity;
rp_window *win;
@@ -3604,7 +3605,7 @@ set_maxsizegravity (struct cmdarg **args)
}
cmdret *
-cmd_msgwait (int interactive, struct cmdarg **args)
+cmd_msgwait (int interactive UNUSED, struct cmdarg **args)
{
if (args[0] == NULL)
return cmdret_new (RET_SUCCESS, "%d", defaults.bar_timeout);
@@ -3631,18 +3632,18 @@ set_bargravity (struct cmdarg **args)
static void
update_gc (rp_screen *s)
{
- XGCValues gv;
+ XGCValues gcv;
- gv.foreground = s->fg_color;
- gv.background = s->bg_color;
- gv.function = GXcopy;
- gv.line_width = 1;
- gv.subwindow_mode = IncludeInferiors;
+ gcv.foreground = s->fg_color;
+ gcv.background = s->bg_color;
+ gcv.function = GXcopy;
+ gcv.line_width = 1;
+ gcv.subwindow_mode = IncludeInferiors;
XFreeGC (dpy, s->normal_gc);
s->normal_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground
| GCFunction | GCLineWidth
- | GCSubwindowMode, &gv);
+ | GCSubwindowMode, &gcv);
}
#ifndef USE_XFT_FONT
@@ -4091,7 +4092,7 @@ set_bwcolor (struct cmdarg **args)
}
cmdret *
-cmd_setenv (int interactive, struct cmdarg **args)
+cmd_setenv (int interactive UNUSED, struct cmdarg **args)
{
struct sbuf *env;
@@ -4118,7 +4119,7 @@ cmd_setenv (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_getenv (int interactive, struct cmdarg **args)
+cmd_getenv (int interactive UNUSED, struct cmdarg **args)
{
char *value;
@@ -4132,7 +4133,7 @@ cmd_getenv (int interactive, struct cmdarg **args)
/* Thanks to Gergely Nagy <[email protected]> for the original
patch. */
cmdret *
-cmd_chdir (int interactive, struct cmdarg **args)
+cmd_chdir (int interactive UNUSED, struct cmdarg **args)
{
char *dir;
@@ -4156,7 +4157,7 @@ cmd_chdir (int interactive, struct cmdarg **args)
/* Thanks to Gergely Nagy <[email protected]> for the original
patch. */
cmdret *
-cmd_unsetenv (int interactive, struct cmdarg **args)
+cmd_unsetenv (int interactive UNUSED, struct cmdarg **args)
{
struct sbuf *s;
@@ -4174,7 +4175,7 @@ cmd_unsetenv (int interactive, struct cmdarg **args)
/* Thanks to Gergely Nagy <[email protected]> for the original
patch. */
cmdret *
-cmd_info (int interactive, struct cmdarg **args)
+cmd_info (int interactive UNUSED, struct cmdarg **args)
{
struct sbuf *buf;
char *tmp;
@@ -4207,14 +4208,14 @@ cmd_info (int interactive, struct cmdarg **args)
/* Thanks to Gergely Nagy <[email protected]> for the original
patch. */
cmdret *
-cmd_lastmsg (int interactive, struct cmdarg **args)
+cmd_lastmsg (int interactive UNUSED, struct cmdarg **args UNUSED)
{
show_last_message();
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_focusup (int interactive, struct cmdarg **args)
+cmd_focusup (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4227,7 +4228,7 @@ cmd_focusup (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_focusdown (int interactive, struct cmdarg **args)
+cmd_focusdown (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4240,7 +4241,7 @@ cmd_focusdown (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_focusleft (int interactive, struct cmdarg **args)
+cmd_focusleft (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4253,7 +4254,7 @@ cmd_focusleft (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_focusright (int interactive, struct cmdarg **args)
+cmd_focusright (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4266,7 +4267,7 @@ cmd_focusright (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_exchangeup (int interactive, struct cmdarg **args)
+cmd_exchangeup (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4277,7 +4278,7 @@ cmd_exchangeup (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_exchangedown (int interactive, struct cmdarg **args)
+cmd_exchangedown (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4288,7 +4289,7 @@ cmd_exchangedown (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_exchangeleft (int interactive, struct cmdarg **args)
+cmd_exchangeleft (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4299,7 +4300,7 @@ cmd_exchangeleft (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_exchangeright (int interactive, struct cmdarg **args)
+cmd_exchangeright (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame;
@@ -4310,7 +4311,7 @@ cmd_exchangeright (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_swap (int interactive, struct cmdarg **args)
+cmd_swap (int interactive UNUSED, struct cmdarg **args)
{
rp_screen *s;
rp_frame *dest_frame;
@@ -4332,7 +4333,7 @@ cmd_swap (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_restart (int interactive, struct cmdarg **args)
+cmd_restart (int interactive UNUSED, struct cmdarg **args UNUSED)
{
hup_signalled = 1;
return cmdret_new (RET_SUCCESS, NULL);
@@ -4355,7 +4356,7 @@ cmd_startup_message (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_focuslast (int interactive, struct cmdarg **args)
+cmd_focuslast (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame *frame = find_last_frame();
@@ -4410,7 +4411,7 @@ set_barpadding (struct cmdarg **args)
}
cmdret *
-cmd_alias (int interactive, struct cmdarg **args)
+cmd_alias (int interactive UNUSED, struct cmdarg **args)
{
/* Add or update the alias. */
add_alias (ARG_STRING(0), ARG_STRING(1));
@@ -4418,13 +4419,13 @@ cmd_alias (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_unalias (int interactive, struct cmdarg **args)
+cmd_unalias (int interactive UNUSED, struct cmdarg **args)
{
- int index;
+ int i;
/* Are we updating an existing alias, or creating a new one? */
- index = find_alias_index (ARG_STRING(0));
- if (index >= 0)
+ i = find_alias_index (ARG_STRING(0));
+ if (i >= 0)
{
char *tmp;
@@ -4433,15 +4434,15 @@ cmd_unalias (int interactive, struct cmdarg **args)
/* Free the alias and put the last alias in the the space to
keep alias_list from becoming sparse. This code must jump
through some hoops to correctly handle the case when
- alias_list_last == index. */
- tmp = alias_list[index].alias;
- alias_list[index].alias = xstrdup (alias_list[alias_list_last].alias);
+ alias_list_last == i. */
+ tmp = alias_list[i].alias;
+ alias_list[i].alias = xstrdup (alias_list[alias_list_last].alias);
free (tmp);
free (alias_list[alias_list_last].alias);
/* Do the same for the name element. */
- tmp = alias_list[index].name;
- alias_list[index].name = xstrdup (alias_list[alias_list_last].name);
+ tmp = alias_list[i].name;
+ alias_list[i].name = xstrdup (alias_list[alias_list_last].name);
free (tmp);
free (alias_list[alias_list_last].name);
}
@@ -4452,7 +4453,7 @@ cmd_unalias (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_nextscreen (int interactive, struct cmdarg **args)
+cmd_nextscreen (int interactive UNUSED, struct cmdarg **args UNUSED)
{
int new_screen;
@@ -4470,7 +4471,7 @@ cmd_nextscreen (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_prevscreen (int interactive, struct cmdarg **args)
+cmd_prevscreen (int interactive UNUSED, struct cmdarg **args UNUSED)
{
int new_screen;
@@ -4488,7 +4489,7 @@ cmd_prevscreen (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_sselect(int interactive, struct cmdarg **args)
+cmd_sselect(int interactive UNUSED, struct cmdarg **args)
{
int new_screen;
@@ -4669,7 +4670,7 @@ sync_wins (rp_screen *s)
static int tmpwm_error_raised = 0;
static int
-tmpwm_error_handler (Display *d, XErrorEvent *e)
+tmpwm_error_handler (Display *d UNUSED, XErrorEvent *e)
{
if (e->request_code == X_ChangeWindowAttributes && e->error_code == BadAccess)
{
@@ -4682,7 +4683,7 @@ tmpwm_error_handler (Display *d, XErrorEvent *e)
/* Temporarily give control over to another window manager, reclaiming */
/* control when that WM terminates. */
cmdret *
-cmd_tmpwm (int interactive, struct cmdarg **args)
+cmd_tmpwm (int interactive UNUSED, struct cmdarg **args)
{
struct list_head *tmp, *iter;
rp_window *win = NULL;
@@ -4802,12 +4803,12 @@ fdump (rp_screen *screen)
/* FIXME: Oooh, gross! there's a trailing comma, yuk! */
list_for_each_entry (cur, &(screen->frames), node)
{
- char *tmp;
+ char *t;
- tmp = frame_dump (cur, screen);
- sbuf_concat (s, tmp);
+ t = frame_dump (cur, screen);
+ sbuf_concat (s, t);
sbuf_concat (s, ",");
- free (tmp);
+ free (t);
}
tmp = sbuf_get (s);
@@ -4816,7 +4817,7 @@ fdump (rp_screen *screen)
}
cmdret *
-cmd_fdump (int interactively, struct cmdarg **args)
+cmd_fdump (int interactively UNUSED, struct cmdarg **args)
{
if (args[0] == NULL)
{
@@ -4846,20 +4847,20 @@ static cmdret *
frestore (char *data, rp_screen *s)
{
char *token;
- char *dup;
+ char *d;
rp_frame *new, *cur;
rp_window *win;
struct list_head fset;
int max = -1;
- char *nexttok;
+ char *nexttok = NULL;
INIT_LIST_HEAD (&fset);
- dup = xstrdup (data);
- token = strtok_r (dup, ",", &nexttok);
+ d = xstrdup (data);
+ token = strtok_r (d, ",", &nexttok);
if (token == NULL)
{
- free (dup);
+ free (d);
return cmdret_new (RET_FAILURE, "frestore: invalid frame format");
}
@@ -4869,14 +4870,14 @@ frestore (char *data, rp_screen *s)
new = frame_read (token, s);
if (new == NULL)
{
- free (dup);
+ free (d);
return cmdret_new (RET_SUCCESS, "frestore: invalid frame format");;
}
list_add_tail (&new->node, &fset);
token = strtok_r (NULL, ",", &nexttok);
}
- free (dup);
+ free (d);
/* Clear all the frames. */
list_for_each_entry (cur, &s->frames, node)
@@ -4895,8 +4896,6 @@ frestore (char *data, rp_screen *s)
/* Process the frames a bit to make sure everything lines up. */
list_for_each_entry (cur, &s->frames, node)
{
- rp_window *win;
-
PRINT_DEBUG (("restore %d %d\n", cur->number, cur->win_number));
/* Grab the frame's number, but if it already exists request a
@@ -4915,8 +4914,7 @@ frestore (char *data, rp_screen *s)
/* Update the window the frame points to. */
if (cur->win_number != EMPTY)
{
- win = find_window_number (cur->win_number);
- set_frames_window (cur, win);
+ set_frames_window (cur, find_window_number (cur->win_number));
}
}
@@ -4939,14 +4937,14 @@ frestore (char *data, rp_screen *s)
}
cmdret *
-cmd_frestore (int interactively, struct cmdarg **args)
+cmd_frestore (int interactively UNUSED, struct cmdarg **args)
{
push_frame_undo (current_screen()); /* fdump to stack */
return frestore (ARG_STRING(0), current_screen());
}
cmdret *
-cmd_verbexec (int interactive, struct cmdarg **args)
+cmd_verbexec (int interactive UNUSED, struct cmdarg **args)
{
marked_message_printf(0, 0, "Running %s", ARG_STRING(0));
spawn (ARG_STRING(0), 0, current_frame());
@@ -4970,28 +4968,28 @@ set_winliststyle (struct cmdarg **args)
}
cmdret *
-cmd_gnext (int interactive, struct cmdarg **args)
+cmd_gnext (int interactive UNUSED, struct cmdarg **args UNUSED)
{
set_current_group (group_next_group ());
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_gprev (int interactive, struct cmdarg **args)
+cmd_gprev (int interactive UNUSED, struct cmdarg **args UNUSED)
{
set_current_group (group_prev_group ());
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_gother (int interactive, struct cmdarg **args)
+cmd_gother (int interactive UNUSED, struct cmdarg **args UNUSED)
{
set_current_group (group_last_group ());
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_gnew (int interactive, struct cmdarg **args)
+cmd_gnew (int interactive UNUSED, struct cmdarg **args)
{
if (groups_find_group_by_name (ARG_STRING (0), 1))
return cmdret_new (RET_FAILURE, "gnew: group already exists");
@@ -5000,7 +4998,7 @@ cmd_gnew (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_gnewbg (int interactive, struct cmdarg **args)
+cmd_gnewbg (int interactive UNUSED, struct cmdarg **args)
{
if (groups_find_group_by_name (ARG_STRING (0), 1))
return cmdret_new (RET_FAILURE, "gnewbg: group already exists");
@@ -5009,7 +5007,7 @@ cmd_gnewbg (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_grename (int interactive, struct cmdarg **args)
+cmd_grename (int interactive UNUSED, struct cmdarg **args)
{
if (groups_find_group_by_name (ARG_STRING (0), 1))
return cmdret_new (RET_FAILURE, "grename: duplicate group name");
@@ -5034,7 +5032,7 @@ cmd_gselect (int interactive, struct cmdarg **args)
/* Show all the groups, with the current one highlighted. */
cmdret *
-cmd_groups (int interactive, struct cmdarg **args)
+cmd_groups (int interactive, struct cmdarg **args UNUSED)
{
rp_group *cur;
int mark_start = 0, mark_end = 0;
@@ -5101,7 +5099,7 @@ cmd_groups (int interactive, struct cmdarg **args)
/* Move a window to a different group. */
cmdret *
-cmd_gmove (int interactive, struct cmdarg **args)
+cmd_gmove (int interactive UNUSED, struct cmdarg **args)
{
if (current_window() == NULL)
return cmdret_new (RET_FAILURE, "gmove: no focused window");
@@ -5111,14 +5109,14 @@ cmd_gmove (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_gmerge (int interactive, struct cmdarg **args)
+cmd_gmerge (int interactive UNUSED, struct cmdarg **args)
{
groups_merge (ARG(0,group), rp_current_group);
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_addhook (int interactive, struct cmdarg **args)
+cmd_addhook (int interactive UNUSED, struct cmdarg **args)
{
struct list_head *hook;
struct sbuf *cmd;
@@ -5136,7 +5134,7 @@ cmd_addhook (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_remhook (int interactive, struct cmdarg **args)
+cmd_remhook (int interactive UNUSED, struct cmdarg **args)
{
struct sbuf *cmd;
@@ -5150,7 +5148,7 @@ cmd_remhook (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_listhook (int interactive, struct cmdarg **args)
+cmd_listhook (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret;
struct sbuf *buffer;
@@ -5179,7 +5177,7 @@ cmd_listhook (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_gdelete (int interactive, struct cmdarg **args)
+cmd_gdelete (int interactive UNUSED, struct cmdarg **args)
{
rp_group *g;
@@ -5206,7 +5204,7 @@ cmd_gdelete (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_readkey (int interactive, struct cmdarg **args)
+cmd_readkey (int interactive UNUSED, struct cmdarg **args)
{
char *keysym_name;
rp_action *key_action;
@@ -5246,7 +5244,7 @@ cmd_readkey (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_newkmap (int interactive, struct cmdarg **args)
+cmd_newkmap (int interactive UNUSED, struct cmdarg **args)
{
rp_keymap *map;
@@ -5261,7 +5259,7 @@ cmd_newkmap (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_delkmap (int interactive, struct cmdarg **args)
+cmd_delkmap (int interactive UNUSED, struct cmdarg **args)
{
rp_keymap *map, *top, *root;
@@ -5289,7 +5287,7 @@ set_framesels (struct cmdarg **args)
}
cmdret *
-cmd_set (int interactive, struct cmdarg **args)
+cmd_set (int interactive UNUSED, struct cmdarg **args)
{
if (args[0] == NULL)
{
@@ -5301,13 +5299,13 @@ cmd_set (int interactive, struct cmdarg **args)
list_last (last, &set_vars, node);
list_for_each_entry (cur, &set_vars, node)
{
- cmdret *ret;
- ret = cur->set_fn (args);
- sbuf_printf_concat (s, "%s: %s", cur->var, ret->output);
+ cmdret *r;
+ r = cur->set_fn (args);
+ sbuf_printf_concat (s, "%s: %s", cur->var, r->output);
/* Skip a newline on the last line. */
if (cur != last)
sbuf_concat (s, "\n");
- cmdret_free (ret);
+ cmdret_free (r);
}
/* Return the accumulated string. */
@@ -5386,7 +5384,7 @@ cmd_set (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_sfdump (int interactively, struct cmdarg **args)
+cmd_sfdump (int interactively UNUSED, struct cmdarg **args UNUSED)
{
cmdret *ret;
struct sbuf *s;
@@ -5419,13 +5417,13 @@ cmd_sfdump (int interactively, struct cmdarg **args)
}
cmdret *
-cmd_sfrestore (int interactively, struct cmdarg **args)
+cmd_sfrestore (int interactively UNUSED, struct cmdarg **args)
{
int out_of_screen = 0;
int number_of_frames = 0;
int j;
long x;
- char *dup;
+ char *d;
char *token;
char *ptr;
struct sbuf *buffer[num_screens];
@@ -5436,11 +5434,11 @@ cmd_sfrestore (int interactively, struct cmdarg **args)
}
/* now split the whole input to the corresponding screens */
- dup = xstrdup (ARG_STRING(0));
+ d = xstrdup (ARG_STRING(0));
- token = strtok (dup, ",");
+ token = strtok (d, ",");
if (token == NULL) {
- free (dup);
+ free (d);
return cmdret_new (RET_FAILURE, "sfrestore: invalid frame format");
}
@@ -5471,7 +5469,7 @@ cmd_sfrestore (int interactively, struct cmdarg **args)
token = strtok (NULL, ",");
}
- free (dup);
+ free (d);
/* now restore the frames for each screen */
for (j=0; j<num_screens; j++) {
@@ -5491,7 +5489,7 @@ cmd_sfrestore (int interactively, struct cmdarg **args)
}
cmdret *
-cmd_sdump (int interactive, struct cmdarg **args)
+cmd_sdump (int interactive UNUSED, struct cmdarg **args UNUSED)
{
cmdret *ret;
struct sbuf *s;
@@ -5658,7 +5656,7 @@ cmd_iprev (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_cother (int interactive, struct cmdarg **args)
+cmd_cother (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_window *cur, *w;
@@ -5674,7 +5672,7 @@ cmd_cother (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_iother (int interactive, struct cmdarg **args)
+cmd_iother (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_window *cur, *w;
@@ -5690,7 +5688,7 @@ cmd_iother (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_undo (int interactive, struct cmdarg **args)
+cmd_undo (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame_undo *cur;
@@ -5707,7 +5705,7 @@ cmd_undo (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_redo (int interactive, struct cmdarg **args)
+cmd_redo (int interactive UNUSED, struct cmdarg **args UNUSED)
{
rp_frame_undo *cur;
@@ -5726,7 +5724,7 @@ cmd_redo (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_prompt (int interactive, struct cmdarg **args)
+cmd_prompt (int interactive UNUSED, struct cmdarg **args)
{
cmdret *ret;
char *query, *output, *prefix;
@@ -5757,7 +5755,7 @@ cmd_prompt (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_describekey (int interactive, struct cmdarg **args)
+cmd_describekey (int interactive UNUSED, struct cmdarg **args)
{
char *keysym_name;
rp_action *key_action;
@@ -5801,7 +5799,7 @@ cmd_describekey (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_dedicate (int interactive, struct cmdarg **args)
+cmd_dedicate (int interactive UNUSED, struct cmdarg **args)
{
rp_frame *f;
@@ -5820,14 +5818,14 @@ cmd_dedicate (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_putsel (int interactive, struct cmdarg **args)
+cmd_putsel (int interactive UNUSED, struct cmdarg **args)
{
set_selection(ARG_STRING(0));
return cmdret_new (RET_SUCCESS, NULL);
}
cmdret *
-cmd_getsel (int interactive, struct cmdarg **args)
+cmd_getsel (int interactive UNUSED, struct cmdarg **args UNUSED)
{
char *sel = get_selection();
cmdret *ret;
@@ -5839,7 +5837,7 @@ cmd_getsel (int interactive, struct cmdarg **args)
/* This is a command that restores old commands that have been
recently depricated. */
cmdret *
-cmd_compat (int interactive, struct cmdarg **args)
+cmd_compat (int interactive UNUSED, struct cmdarg **args UNUSED)
{
add_alias ("defresizeunit", "set resizeunit");
add_alias ("defwingravity", "set wingravity");
diff --git a/src/communications.c b/src/communications.c
index b3e95f2..5f0cdc7 100644
--- a/src/communications.c
+++ b/src/communications.c
@@ -109,7 +109,7 @@ send_command (unsigned char interactive, unsigned char *cmd, int screen_num)
XSelectInput (dpy, w, PropertyChangeMask);
XChangeProperty (dpy, w, rp_command, XA_STRING,
- 8, PropModeReplace, sbuf_get(s), strlen ((char *)cmd) + 2);
+ 8, PropModeReplace, (unsigned char*)sbuf_get(s), strlen ((char *)cmd) + 2);
XChangeProperty (dpy, root,
rp_command_request, XA_WINDOW,
diff --git a/src/data.h b/src/data.h
index a7785de..062853b 100644
--- a/src/data.h
+++ b/src/data.h
@@ -384,7 +384,7 @@ struct rp_frame_undo
typedef struct rp_xselection rp_xselection;
struct rp_xselection
{
- unsigned char *text;
+ char *text;
int len;
};
diff --git a/src/editor.c b/src/editor.c
index 23b6e35..ac10d1f 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -415,13 +415,13 @@ editor_history_next (rp_input_line *line)
}
static edit_status
-editor_abort (rp_input_line *line)
+editor_abort (rp_input_line *line UNUSED)
{
return EDIT_ABORT;
}
static edit_status
-editor_no_action (rp_input_line *line)
+editor_no_action (rp_input_line *line UNUSED)
{
return EDIT_NO_OP;
}
diff --git a/src/frame.c b/src/frame.c
index d7c0fb9..c42e2ab 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -198,9 +198,9 @@ frame_read (char *str, rp_screen *screen)
Window w = 0L;
rp_window *win;
rp_frame *f;
- char *tmp, *dup;
- int screen_width = -1;
- int screen_height = -1;
+ char *tmp, *d;
+ int s_width = -1;
+ int s_height = -1;
/* Create a blank frame. */
f = xmalloc (sizeof (rp_frame));
@@ -208,14 +208,14 @@ frame_read (char *str, rp_screen *screen)
PRINT_DEBUG(("parsing '%s'\n", str));
- dup = xstrdup(str);
- tmp = strtok_ws (dup);
+ d = xstrdup(str);
+ tmp = strtok_ws (d);
/* Verify it starts with '(frame ' */
if (strcmp(tmp, "(frame"))
{
PRINT_DEBUG(("Doesn't start with '(frame '\n"));
- free (dup);
+ free (d);
free (f);
return NULL;
}
@@ -234,9 +234,9 @@ frame_read (char *str, rp_screen *screen)
else if (!strcmp(tmp, ":height"))
read_slot(f->height);
else if (!strcmp(tmp, ":screenw"))
- read_slot(screen_width);
+ read_slot(s_width);
else if (!strcmp(tmp, ":screenh"))
- read_slot(screen_height);
+ read_slot(s_height);
else if (!strcmp(tmp, ":window"))
read_slot(w);
else if (!strcmp(tmp, ":last-access"))
@@ -260,18 +260,18 @@ frame_read (char *str, rp_screen *screen)
}
if (tmp)
PRINT_ERROR(("Frame has trailing garbage\n"));
- free (dup);
+ free (d);
/* adjust x, y, width and height to a possible screen size change */
- if (screen_width > 0)
+ if (s_width > 0)
{
- f->x = (f->x*screen->width)/screen_width;
- f->width = (f->width*screen->width)/screen_width;
+ f->x = (f->x*screen->width)/s_width;
+ f->width = (f->width*screen->width)/s_width;
}
- if (screen_height > 0)
+ if (s_height > 0)
{
- f->y = (f->y*screen->height)/screen_height;
- f->height = (f->height*screen->height)/screen_height;
+ f->y = (f->y*screen->height)/s_height;
+ f->height = (f->height*screen->height)/s_height;
}
/* Perform some integrity checks on what we got and fix any
diff --git a/src/globals.c b/src/globals.c
index 9638996..5618cfb 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -95,7 +95,7 @@ x_export_selection (void)
if (XGetSelectionOwner(dpy, XA_PRIMARY) != screens[0].key_window)
PRINT_ERROR(("can't get primary selection"));
XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, XA_STRING, 8,
- PropModeReplace, selection.text, selection.len);
+ PropModeReplace, (unsigned char*)selection.text, selection.len);
}
void
@@ -172,7 +172,7 @@ get_primary_selection(void)
continue;
/* Accumulate the data. FIXME: ct.value may not be NULL
terminated. */
- sbuf_nconcat (s, ct.value, ct.nitems);
+ sbuf_nconcat (s, (const char*)ct.value, ct.nitems);
XFree(ct.value);
}
return sbuf_free_struct (s);
diff --git a/src/globals.h b/src/globals.h
index 881d3e4..54eb113 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -66,6 +66,12 @@
#define GROUP_DELETE_GROUP_NONEMPTY 1
#define GROUP_DELETE_LAST_GROUP 2
+#ifdef __GNUC__
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
+
/* The list of groups. */
extern struct list_head rp_groups;
diff --git a/src/history.c b/src/history.c
index b0e66fd..a41483a 100644
--- a/src/history.c
+++ b/src/history.c
@@ -205,8 +205,9 @@ history_load (void)
free (filename);
return;
}
- if (!fclose(f))
+ if (!fclose(f)) {
PRINT_DEBUG (("ratpoison: error reading %s - %s\n", filename, strerror (errno)));
+ }
free (filename);
}
@@ -237,8 +238,9 @@ history_save (void)
free (filename);
return;
}
- if (!fclose(f))
+ if (!fclose(f)) {
PRINT_DEBUG (("ratpoison: error writing %s - %s\n", filename, strerror (errno)));
+ }
free (filename);
}
diff --git a/src/input.c b/src/input.c
index 35454df..d6dfaa9 100644
--- a/src/input.c
+++ b/src/input.c
@@ -432,7 +432,7 @@ update_input_window (rp_screen *s, rp_input_line *line)
int input_width = rp_text_width (s, defaults.font, line->buffer, line->length);
int total_width;
GC lgc;
- XGCValues gv;
+ XGCValues gcv;
int height;
total_width = defaults.bar_x_padding * 2 + prompt_width + input_width + MAX_FONT_WIDTH (defaults.font);
@@ -462,9 +462,9 @@ update_input_window (rp_screen *s, rp_input_line *line)
line->buffer,
line->length);
- gv.function = GXxor;
- gv.foreground = s->fg_color ^ s->bg_color;
- lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gv);
+ gcv.function = GXxor;
+ gcv.foreground = s->fg_color ^ s->bg_color;
+ lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gcv);
/* Draw a cheap-o cursor - MkII */
XFillRectangle (dpy, s->input_window, lgc,
@@ -482,15 +482,15 @@ ring_bell (void)
{
#ifdef VISUAL_BELL
GC lgc;
- XGCValues gv;
+ XGCValues gcv;
XWindowAttributes attr;
rp_screen *s = current_screen ();
XGetWindowAttributes (dpy, s->input_window, &attr);
- gv.function = GXxor;
- gv.foreground = s->fg_color ^ s->bg_color;
- lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gv);
+ gcv.function = GXxor;
+ gcv.foreground = s->fg_color ^ s->bg_color;
+ lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gcv);
XFillRectangle (dpy, s->input_window, lgc, 0, 0, attr.width, attr.height);
XFlush (dpy);
diff --git a/src/linkedlist.c b/src/linkedlist.c
index f79757b..ae3d143 100644
--- a/src/linkedlist.c
+++ b/src/linkedlist.c
@@ -24,9 +24,11 @@
#include "linkedlist.h"
+#if __GNUC__ <= 3
void
prefetch(const void *x)
{;}
+#endif
/*
* Insert a new entry between two known consecutive entries.
diff --git a/src/linkedlist.h b/src/linkedlist.h
index 7f147b1..4434766 100644
--- a/src/linkedlist.h
+++ b/src/linkedlist.h
@@ -76,7 +76,11 @@ void list_add(struct list_head *new, struct list_head *head);
void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next);
+#if __GNUC__ > 3
+#define prefetch __builtin_prefetch
+#else
void prefetch(const void *x);
+#endif
/* Return the last element in the list. */
#define list_last(last, head, member) \
diff --git a/src/main.c b/src/main.c
index a90ccf2..3f293b8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -202,19 +202,19 @@ str_comp (char *s1, char *s2, int len)
}
static void
-sighandler (int signum)
+sighandler (int signum UNUSED)
{
kill_signalled++;
}
static void
-hup_handler (int signum)
+hup_handler (int signum UNUSED)
{
hup_signalled++;
}
static void
-alrm_handler (int signum)
+alrm_handler (int signum UNUSED)
{
alarm_signalled++;
}
@@ -250,7 +250,7 @@ check_child_procs (void)
}
void
-chld_handler (int signum)
+chld_handler (int signum UNUSED)
{
int serrno;
@@ -574,7 +574,7 @@ main (int argc, char *argv[])
{
int i;
int c;
- char **command = NULL;
+ char **cmd = NULL;
int cmd_count = 0;
int screen_arg = 0;
int screen_num = 0;
@@ -602,17 +602,17 @@ main (int argc, char *argv[])
print_version ();
break;
case 'c':
- if (!command)
+ if (!cmd)
{
- command = xmalloc (sizeof(char *));
+ cmd = xmalloc (sizeof(char *));
cmd_count = 0;
}
else
{
- command = xrealloc (command, sizeof (char *) * (cmd_count + 1));
+ cmd = xrealloc (cmd, sizeof (char *) * (cmd_count + 1));
}
- command[cmd_count] = xstrdup (optarg);
+ cmd[cmd_count] = xstrdup (optarg);
cmd_count++;
break;
case 'd':
@@ -658,19 +658,19 @@ main (int argc, char *argv[])
if (cmd_count > 0)
{
- int i;
+ int j;
- for (i=0; i<cmd_count; i++)
+ for (j=0; j<cmd_count; j++)
{
if (screen_arg)
- send_command (interactive, (unsigned char *)command[i], screen_num);
+ send_command (interactive, (unsigned char *)cmd[j], screen_num);
else
- send_command (interactive, (unsigned char *)command[i], -1);
+ send_command (interactive, (unsigned char *)cmd[j], -1);
- free (command[i]);
+ free (cmd[j]);
}
- free (command);
+ free (cmd);
XCloseDisplay (dpy);
return EXIT_SUCCESS;
}
diff --git a/src/screen.c b/src/screen.c
index b3b9840..75a97de 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -237,7 +237,7 @@ init_rat_cursor (rp_screen *s)
static void
init_screen (rp_screen *s, int screen_num)
{
- XGCValues gv;
+ XGCValues gcv;
int xine_screen_num;
/* We use screen_num below to refer to the real X screen number, but
@@ -300,15 +300,15 @@ init_screen (rp_screen *s, int screen_num)
s->bw_color = BlackPixel (dpy, s->screen_num);
/* Setup the GC for drawing the font. */
- gv.foreground = s->fg_color;
- gv.background = s->bg_color;
- gv.function = GXcopy;
- gv.line_width = 1;
- gv.subwindow_mode = IncludeInferiors;
+ gcv.foreground = s->fg_color;
+ gcv.background = s->bg_color;
+ gcv.function = GXcopy;
+ gcv.line_width = 1;
+ gcv.subwindow_mode = IncludeInferiors;
s->normal_gc = XCreateGC(dpy, s->root,
GCForeground | GCBackground | GCFunction
| GCLineWidth | GCSubwindowMode,
- &gv);
+ &gcv);
/* Create the program bar window. */
s->bar_is_raised = 0;
diff --git a/src/window.c b/src/window.c
index 889772c..6720833 100644
--- a/src/window.c
+++ b/src/window.c
@@ -260,10 +260,11 @@ find_window (Window w)
if (!win)
{
win = find_window_in_list (w, &rp_unmapped_window);
- if (win)
+ if (win) {
PRINT_DEBUG (("Window found in unmapped window list\n"));
- else
+ } else {
PRINT_DEBUG (("Window not found.\n"));
+ }
}
else
{
@@ -665,7 +666,9 @@ set_active_window_body (rp_window *win, int force)
last_win = set_frames_window (frame, win);
- if (last_win) PRINT_DEBUG (("last window: %s\n", window_name (last_win)));
+ if (last_win) {
+ PRINT_DEBUG (("last window: %s\n", window_name (last_win)));
+ }
PRINT_DEBUG (("new window: %s\n", window_name (win)));
/* Make sure the window comes up full screen */
_______________________________________________
Ratpoison-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/ratpoison-devel