summaryrefslogtreecommitdiff
blob: 6efb77ff0b35f8fd0966e3f45314f195f1c27b55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
https://bugs.launchpad.net/musca/+bug/1236500


--- a/musca.c
+++ b/musca.c
@@ -421,7 +421,7 @@
 	if (s->depth)
 	{
 		int *indexes = allocate(sizeof(int) * s->depth);
-		int count = 0, i; Window *w;
+		int count = 0, i; Window *w = NULL;
 		FOR_STACK (w, s, Window*, i)
 		{
 			note("%d", i);
@@ -1673,7 +1673,6 @@
 	frame *f = t->frames;
 	frame **group = NULL;
 	int i = 0, x, y, w, h;
-	ubyte changes = 0;
 	if (direction == HORIZONTAL)
 	{
 		if (f->x + f->w >= t->head->screen->width - t->r)
@@ -1684,7 +1683,6 @@
 				group = frame_siblings(f, LEFT);
 				if (frame_siblings_growable(group, LEFT, size))
 				{
-					changes = 1;
 					x = f->x - size; w = size; y = f->y; h = 0;
 					for (i = 0; group[i]; i++)
 						y = MIN(y, group[i]->y), h += group[i]->h;
@@ -1702,7 +1700,6 @@
 			group = frame_siblings(f, RIGHT);
 			if (frame_siblings_growable(group, RIGHT, size))
 			{
-				changes = 1;
 				x = f->x + f->w; w = size; y = f->y; h = 0;
 				for (i = 0; group[i]; i++)
 					y = MIN(y, group[i]->y), h += group[i]->h;
@@ -1725,7 +1722,6 @@
 				group = frame_siblings(f, TOP);
 				if (frame_siblings_growable(group, TOP, size))
 				{
-					changes = 1;
 					y = f->y - size; h = size; x = f->x; w = 0;
 					for (i = 0; group[i]; i++)
 						x = MIN(x, group[i]->x), w += group[i]->w;
@@ -1743,7 +1739,6 @@
 			group = frame_siblings(f, BOTTOM);
 			if (frame_siblings_growable(group, BOTTOM, size))
 			{
-				changes = 1;
 				y = f->y + f->h; h = size; x = f->x; w = 0;
 				for (i = 0; group[i]; i++)
 					x = MIN(x, group[i]->x), w += group[i]->w;
@@ -2205,11 +2200,9 @@
 char* com_frame_split(char *cmd, regmatch_t *subs)
 {
 	group *g = heads->groups; frame *f = g->frames;
-	int sw = heads->screen->width  - g->l - g->r,
-	    sh = heads->screen->height - g->t - g->b;
 	char *mode = regsubstr(cmd, subs, 1);
-	ucell fs = f->h, ss = sh; ubyte dir = VERTICAL;
-	if (*mode == 'h') { fs = f->w; ss = sw; dir = HORIZONTAL; }
+	ucell fs = f->h; ubyte dir = VERTICAL;
+	if (*mode == 'h') { fs = f->w; dir = HORIZONTAL; }
 	dcell size = parse_size(cmd, subs, 2, fs);
 	frame_split(dir, size / fs);
 	free(mode);
@@ -2630,7 +2623,7 @@
 }
 char* com_command(char *cmd, regmatch_t *subs)
 {
-	int i; alias *a; autostr s; str_create(&s);
+	int i; alias *a = NULL; autostr s; str_create(&s);
 	str_print(&s, strlen(command_hints)+NOTE, "%s \n", command_hints);
 	FOR_STACK (a, aliases, alias*, i) str_print(&s, NOTE, "%s \n", a->name);
 	menu_wrapper(s.pad, settings[ms_run_musca_command].s);
@@ -2747,7 +2740,7 @@
 char* show_aliases()
 {
 	autostr s; str_create(&s);
-	alias *a; int i;
+	alias *a = NULL; int i;
 	FOR_STACK (a, aliases, alias*, i)
 		str_print(&s, strlen(a->name)+strlen(a->command)+10, "alias %s %s\n",
 			a->name, a->command);
@@ -2849,7 +2842,7 @@
 }
 char* com_place(char *cmd, regmatch_t *subs)
 {
-	placement *p; int i;
+	placement *p = NULL; int i;
 	char *class = regsubstr(cmd, subs, 1);
 	ubyte flag = parse_flag(cmd, subs, 2, 0);
 	char *group = regsubstr(cmd, subs, 3);
@@ -3441,7 +3434,7 @@
 		autostr s; str_create(&s);
 		for (;;)
 		{
-			char c = getchar();
+			int c = getchar();
 			if (c == EOF) break;
 			str_push(&s, c);
 		}
@@ -3530,7 +3523,7 @@
 }
 void grab_stuff()
 {
-	int i, j, k; head *h; binding *b; ucell *m;
+	int i, j, k; head *h; binding *b; ucell *m = NULL;
 	refresh_bindings();
 	ungrab_stuff();
 	ucell modifiers[] = { 0, LockMask, NumlockMask, LockMask|NumlockMask };
@@ -3550,7 +3543,7 @@
 {
 	int i;
 	command_hash = hash_create();
-	command *c; autostr str; str_create(&str);
+	command *c = NULL; autostr str; str_create(&str);
 	FOR_ARRAY (c, commands, command, i)
 	{
 		char *keys = c->keys;
@@ -3566,7 +3559,7 @@
 	strtrim(command_hints);
 	// compile setting regex
 	setting_hash = hash_create();
-	setting *s;
+	setting *s = NULL;
 	FOR_ARRAY (s, settings, setting, i)
 		hash_set(setting_hash, s->name, s);
 	// compile modmask regex
@@ -3597,7 +3590,7 @@
 }
 void setup_bindings()
 {
-	int i; keymap *k;
+	int i; keymap *k = NULL;
 	// prepare key bindings
 	bindings = stack_create();
 	FOR_ARRAY (k, keymaps, keymap, i)
--- a/tools.c
+++ b/tools.c
@@ -227,7 +227,7 @@
 	ucell ptr = 0;
 	for (;;)
 	{
-		byte c = fgetc(src);
+		int c = fgetc(src);
 		if (c == EOF)
 			break;