applied anonymous patch, I don't think the reversed array access has semantic side-effects

This commit is contained in:
Anselm R Garbe 2011-01-07 16:05:22 +00:00
parent 703c4dd253
commit 0bc4e41ebd
1 changed files with 9 additions and 12 deletions

21
dwm.c
View File

@ -980,7 +980,7 @@ grabkeys(void) {
void void
initfont(const char *fontstr) { initfont(const char *fontstr) {
char *def, **missing; char *def, **missing;
int i, n; int n;
missing = NULL; missing = NULL;
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
@ -996,7 +996,7 @@ initfont(const char *fontstr) {
dc.font.ascent = dc.font.descent = 0; dc.font.ascent = dc.font.descent = 0;
XExtentsOfFontSet(dc.font.set); XExtentsOfFontSet(dc.font.set);
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { while(n--) {
dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent);
xfonts++; xfonts++;
@ -1014,14 +1014,13 @@ initfont(const char *fontstr) {
Bool Bool
isprotodel(Client *c) { isprotodel(Client *c) {
int i, n; int n;
Atom *protocols; Atom *protocols;
Bool ret = False; Bool ret = False;
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
for(i = 0; !ret && i < n; i++) while(!ret && n--)
if(protocols[i] == wmatom[WMDelete]) ret = protocols[n] == wmatom[WMDelete];
ret = True;
XFree(protocols); XFree(protocols);
} }
return ret; return ret;
@ -1029,12 +1028,10 @@ isprotodel(Client *c) {
#ifdef XINERAMA #ifdef XINERAMA
static Bool static Bool
isuniquegeom(XineramaScreenInfo *unique, size_t len, XineramaScreenInfo *info) { isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
unsigned int i; while(n--)
if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
for(i = 0; i < len; i++) && unique[n].width == info->width && unique[n].height == info->height)
if(unique[i].x_org == info->x_org && unique[i].y_org == info->y_org
&& unique[i].width == info->width && unique[i].height == info->height)
return False; return False;
return True; return True;
} }