xserver: Branch 'master'

Daniel Stone daniels at kemper.freedesktop.org
Sat Nov 11 14:13:59 EET 2006


 dix/ffs.c     |    2 ++
 include/dix.h |    3 +++
 2 files changed, 5 insertions(+)

New commits:
diff-tree acb5ff4c73ac4d52201d7c421f488e2ead5c8b9c (from ca094684196886a4a1c10273049fae0705a3edc2)
Author: Jurij Smakov <jurij at wooyd.org>
Date:   Sat Nov 11 14:09:15 2006 +0200

    ffs: handle 0 argument (bug #8968)
    
    Handle an argument of 0 in ffs(), instead of looping indefinitely.
    Add an ffs prototype to dix.h, and add includes to ffs.c.
    (cherry picked from 34164e551e4c3909322d50b09835ca4ac1d49d68 commit)

diff --git a/dix/ffs.c b/dix/ffs.c
index f84f7b4..b75657d 100644
--- a/dix/ffs.c
+++ b/dix/ffs.c
@@ -36,6 +36,8 @@ int
 ffs(int i)
 {
     int j;
+    if (i == 0)
+        return 0;
     for (j = 1; (i & 1) == 0; j++)
 	i >>= 1;
     return j;
diff --git a/include/dix.h b/include/dix.h
index 983a84f..a5a570a 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -817,4 +817,7 @@ typedef struct {
 extern int xstrcasecmp(char *s1, char *s2);
 #endif
 
+/* ffs.c */
+extern int ffs(int i);
+
 #endif /* DIX_H */



More information about the xorg-commit mailing list