From c5841193570edf6eca119c583d9e790eef12dcb1 Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 22 Mar 2011 10:57:31 +0000 Subject: introduce nitems macro, with the appropriate ifndef. ok oga@ --- xutil.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xutil.c') diff --git a/xutil.c b/xutil.c index b50242a..5e5940b 100644 --- a/xutil.c +++ b/xutil.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xutil.c,v 1.33 2011/03/22 10:49:46 okan Exp $ + * $Id: xutil.c,v 1.34 2011/03/22 10:57:31 okan Exp $ */ #include @@ -57,7 +57,7 @@ void xu_btn_grab(Window win, int mask, u_int btn) { int i; - for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++) + for (i = 0; i < nitems(ign_mods); i++) XGrabButton(X_Dpy, btn, (mask | ign_mods[i]), win, False, ButtonMask, GrabModeAsync, GrabModeSync, None, None); @@ -67,7 +67,7 @@ void xu_btn_ungrab(Window win, int mask, u_int btn) { int i; - for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++) + for (i = 0; i < nitems(ign_mods); i++) XUngrabButton(X_Dpy, btn, (mask | ign_mods[i]), win); } @@ -98,7 +98,7 @@ xu_key_grab(Window win, int mask, int keysym) (XKeycodeToKeysym(X_Dpy, code, 1) == keysym)) mask |= ShiftMask; - for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++) + for (i = 0; i < nitems(ign_mods); i++) XGrabKey(X_Dpy, code, (mask | ign_mods[i]), win, True, GrabModeAsync, GrabModeAsync); } @@ -114,7 +114,7 @@ xu_key_ungrab(Window win, int mask, int keysym) (XKeycodeToKeysym(X_Dpy, code, 1) == keysym)) mask |= ShiftMask; - for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++) + for (i = 0; i < nitems(ign_mods); i++) XUngrabKey(X_Dpy, code, (mask | ign_mods[i]), win); } -- cgit v1.2.3-2-gb3c3