cleanup fb67bd66
Connor Lane Smith · 2011-05-15 13:58 1 file(s) · +5 −6
dmenu.c +5 −6
38 38
39 39
static char text[BUFSIZ] = "";
40 40
static int bh, mw, mh;
41 -
static int inputw = 0;
41 +
static int inputw;
42 42
static int lines = 0;
43 43
static int monitor = -1;
44 44
static int promptw;
78 78
			fast = True;
79 79
		else if(!strcmp(argv[i], "-i"))
80 80
			fstrncmp = strncasecmp;
81 -
		else if(i == argc-1)
81 +
		else if(i+1 == argc)
82 82
			goto usage;
83 83
		/* double flags */
84 84
		else if(!strcmp(argv[i], "-l"))
220 220
insert(const char *s, ssize_t n) {
221 221
	if(strlen(text) + n > sizeof text - 1)
222 222
		return;
223 -
	memmove(text + cursor + n, text + cursor, sizeof text - cursor - MAX(n, 0));
223 +
	memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0));
224 224
	if(n > 0)
225 -
		memcpy(text + cursor, s, n);
225 +
		memcpy(&text[cursor], s, n);
226 226
	cursor += n;
227 227
	match();
228 228
}
458 458
		if(strlen(items[i].text) > max)
459 459
			max = strlen(maxstr = items[i].text);
460 460
	}
461 -
	if(maxstr)
462 -
		inputw = textw(dc, maxstr);
461 +
	inputw = maxstr ? textw(dc, maxstr) : 0;
463 462
}
464 463
465 464
void