libXmu: Branch 'master' - 3 commits

Alan Coopersmith alanc at kemper.freedesktop.org
Mon Jan 14 11:24:53 PST 2008


 Makefile.am     |    6 ++++++
 configure.ac    |   17 +++++++++++++++++
 src/Clip.c      |    4 ++--
 src/CvtStdSel.c |    4 ++++
 src/Makefile.am |   27 +++++++++++++++++++++++++--
 src/StdCmap.c   |    4 ++--
 src/StrToWidg.c |    5 ++++-
 7 files changed, 60 insertions(+), 7 deletions(-)

New commits:
commit f11b5a161944dc694ee059f88acb20826bd6d90b
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Jan 14 11:21:36 2008 -0800

    Coverity #52: Dead code in get_os_name()

diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 0422f98..a6f206a 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -114,7 +114,9 @@ get_os_name(void)
 #ifdef OS_NAME
 	return XtNewString(OS_NAME);
 #else
+#if defined(X_OS_FILE) || defined(MOTD_FILE)	
 	FILE *f = NULL;
+#endif
 
 #ifdef USE_UNAME
 	struct utsname utss;
@@ -142,6 +144,7 @@ get_os_name(void)
 #ifdef MOTD_FILE
 	       f = fopen(MOTD_FILE, "r");
 #endif
+#if defined(X_OS_FILE) || defined(MOTD_FILE)
 	if (f) {
 	    char motd[512];
 	    motd[0] = '\0';
@@ -155,6 +158,7 @@ get_os_name(void)
 		return XtNewString(motd);
 	    }
 	}
+#endif
 
 #ifdef sun
 	return XtNewString("SunOS");
commit 6f5ea6a2a0b56674f08f58d95085c0e9a8797fe2
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Sun Jan 13 01:58:12 2008 -0800

    Clear sparse warnings: Using plain integer as NULL pointer

diff --git a/src/Clip.c b/src/Clip.c
index 8d2c845..121a69f 100644
--- a/src/Clip.c
+++ b/src/Clip.c
@@ -799,8 +799,8 @@ XmuScanline *
 XmuScanlineNot(XmuScanline *scanline, int minx, int maxx)
 {
   XmuSegment *z;
-  static XmuSegment x = { 0, 0, 0 };
-  static XmuScanline and = { 0, &x, 0 };
+  static XmuSegment x = { 0, 0, NULL };
+  static XmuScanline and = { 0, &x, NULL };
 
   if (!scanline)
     return (scanline);
diff --git a/src/StdCmap.c b/src/StdCmap.c
index ffce489..3fb3f25 100644
--- a/src/StdCmap.c
+++ b/src/StdCmap.c
@@ -91,7 +91,7 @@ XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
     vinfo_template.depth = depth;
     vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
     if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
-	return 0;
+	return NULL;
 
     /* Check the validity of the combination of visual characteristics,
      * allocation, and colormap property.  Create an XStandardColormap
@@ -101,7 +101,7 @@ XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
     if (! valid_args(vinfo, red_max, green_max, blue_max, property)
 	|| ((stdcmap = XAllocStandardColormap()) == NULL)) {
 	XFree((char *) vinfo);
-	return 0;
+	return NULL;
     }
 
     /* Fill in the XStandardColormap structure */
diff --git a/src/StrToWidg.c b/src/StrToWidg.c
index 22411de..b9fb8a9 100644
--- a/src/StrToWidg.c
+++ b/src/StrToWidg.c
@@ -63,8 +63,11 @@ XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
     int i;
 
     if (*num_args != 1)
+    {
+	i = 0;
 	XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError",
-		   "StringToWidget conversion needs parent arg", NULL, 0);
+		   "StringToWidget conversion needs parent arg", NULL, &i);
+    }
 
     parent = *(Widget*)args[0].addr;
     /* try to match names of normal children */
commit 6f76ccc70a5f5ae834a3e63c9f4f35704837a4d1
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Jan 11 20:43:26 2008 -0800

    Add hooks for checking sources with tools like lint & sparse

diff --git a/Makefile.am b/Makefile.am
index 89ef346..8482dc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,3 +20,9 @@ ChangeLog:
 	(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
 
 dist-hook: ChangeLog
+
+if LINT
+# Check source code with tools like lint & sparse
+lint:
+	(cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/configure.ac b/configure.ac
index 7abdb21..8469d60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,11 @@ AM_MAINTAINER_MODE
 
 AM_CONFIG_HEADER([config.h])
 
+# Require xorg-macros version 1.1.0 or newer for XORG_WITH_LINT macro
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.1)
+
+
 # Checks for programs.
 AC_PROG_LIBTOOL
 AC_PROG_CC
@@ -51,6 +56,18 @@ XTRANS_CONNECTION_FLAGS
 AC_DEFINE(HAS_SNPRINTF, [], [Whether we have snprintf()])
 AC_SUBST(HAS_SNPRINTF)
 
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xmu])
+LINTLIBUU=`echo $LINTLIB | sed s/Xmu/Xmuu/`
+AC_SUBST(LINTLIBUU)
+
+if test "x$GCC" = "xyes"; then
+        GCC_WARNINGS="-Wall -Wpointer-arith -Wstrict-prototypes \
+        -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
+        XMU_CFLAGS="$GCC_WARNINGS $XMU_CFLAGS"
+fi
+
 XORG_RELEASE_VERSION
 
 AC_OUTPUT([Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index df49a20..0f19c5e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,10 +2,12 @@ lib_LTLIBRARIES = libXmu.la libXmuu.la
 
 BITMAP_DEFINES = -DBITMAPDIR=\"$(includedir)/X11/bitmaps\"
 
-AM_CFLAGS = \
+AM_CPPFLAGS = \
 	-I${top_srcdir}/include \
 	-I${top_srcdir}/include/X11/Xmu \
-	$(XMU_CFLAGS) $(BITMAP_DEFINES) -D_BSD_SOURCE
+	$(BITMAP_DEFINES) -D_BSD_SOURCE
+
+AM_CFLAGS = $(XMU_CFLAGS)
 
 libXmu_la_LDFLAGS = -version-number 6:2:0 -no-undefined
 libXmuu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
@@ -62,3 +64,24 @@ libXmu_la_SOURCES = \
 	WidgetNode.c \
 	Xct.c \
 	sharedlib.c
+
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+                $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+	$(LINT) $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES) $(XEXT_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB) $(LINTLIBUU)
+
+$(LINTLIB): $(libXmu_la_SOURCES)
+	$(LINT) -y -oXmu -x $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES) 
+
+$(LINTLIBUU): $(libXmuu_la_SOURCES)
+	$(LINT) -y -oXmuu -x $(ALL_LINT_FLAGS) $(libXmuu_la_SOURCES) 
+endif MAKE_LINT_LIB


More information about the xorg-commit mailing list