applied anonymous patch, I don't think the reversed array access has semantic side-effects 0bc4e41e
Anselm R Garbe · 2011-01-07 16:05 1 file(s) · +9 −12
dwm.c +9 −12
980 980
void
981 981
initfont(const char *fontstr) {
982 982
	char *def, **missing;
983 -
	int i, n;
983 +
	int n;
984 984
985 985
	missing = NULL;
986 986
	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
996 996
		dc.font.ascent = dc.font.descent = 0;
997 997
		XExtentsOfFontSet(dc.font.set);
998 998
		n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
999 -
		for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
999 +
		while(n--) {
1000 1000
			dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
1001 1001
			dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent);
1002 1002
			xfonts++;
1014 1014
1015 1015
Bool
1016 1016
isprotodel(Client *c) {
1017 -
	int i, n;
1017 +
	int n;
1018 1018
	Atom *protocols;
1019 1019
	Bool ret = False;
1020 1020
1021 1021
	if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
1022 -
		for(i = 0; !ret && i < n; i++)
1023 -
			if(protocols[i] == wmatom[WMDelete])
1024 -
				ret = True;
1022 +
		while(!ret && n--)
1023 +
			ret = protocols[n] == wmatom[WMDelete];
1025 1024
		XFree(protocols);
1026 1025
	}
1027 1026
	return ret;
1029 1028
1030 1029
#ifdef XINERAMA
1031 1030
static Bool
1032 -
isuniquegeom(XineramaScreenInfo *unique, size_t len, XineramaScreenInfo *info) {
1033 -
	unsigned int i;
1034 -
1035 -
	for(i = 0; i < len; i++)
1036 -
		if(unique[i].x_org == info->x_org && unique[i].y_org == info->y_org
1037 -
		&& unique[i].width == info->width && unique[i].height == info->height)
1031 +
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
1032 +
	while(n--)
1033 +
		if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
1034 +
		&& unique[n].width == info->width && unique[n].height == info->height)
1038 1035
			return False;
1039 1036
	return True;
1040 1037
}