last-exit r172 - in trunk: . liblast-exit src



Author: bhale
Date: Sun Mar 30 16:21:00 2008
New Revision: 172
URL: http://svn.gnome.org/viewvc/last-exit?rev=172&view=rev

Log:

        Some portability fixes.
        Apply a patch to not use memmem() on non-GNU systems.
        Silently catch failed calls to prctl when changing the process name on
        non-Linux. See Gnome bug #475031.




Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/liblast-exit/player.c
   trunk/src/Driver.cs

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sun Mar 30 16:21:00 2008
@@ -14,6 +14,7 @@
 AC_PROG_CC
 AC_ISC_POSIX
 AC_HEADER_STDC
+AC_CHECK_FUNCS(memmem)
 AM_PROG_LIBTOOL
 
 GSTREAMER_REQUIRED=0.10.11
@@ -60,7 +61,7 @@
 PKG_CHECK_MODULES(GNOMEKEYRINGSHARP, gnome-keyring-sharp-1.0 >= 1.0.0, \
 	have_external_gks="yes", have_external_gks="no")
 if test "x$have_external_gks" != "xyes"; then
-	AC_MSG_RESULT([using internal copy])
+	AC_MSG_RESULT([gnome-keyring-sharp not found - using internal copy])
 fi
 AM_CONDITIONAL(EXTERNAL_GKS, test "x$have_external_gks" = "xyes")
 

Modified: trunk/liblast-exit/player.c
==============================================================================
--- trunk/liblast-exit/player.c	(original)
+++ trunk/liblast-exit/player.c	Sun Mar 30 16:21:00 2008
@@ -27,6 +27,55 @@
 
 #include "player.h"
 
+#ifndef HAVE_MEMMEM
+/*
+ * This uses the "Not So Naive" algorithm, a very simple but
+ * usually effective algorithm, see:
+ *
+ * http://www-igm.univ-mlv.fr/~lecroq/string/
+ *
+ * SYSLINUX is Copyright 1994-2001 H. Peter Anvin, and is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge MA 02139, USA; either version 2 of the
+ * License, or (at your option) any later version.
+ */
+
+#include <string.h>
+
+static void *memmem(const void *haystack, size_t n, const void *needle, size_t m)
+{
+  const unsigned char *y = (const unsigned char *)haystack;
+  const unsigned char *x = (const unsigned char *)needle;
+
+  size_t j, k, l;
+
+  if ( m > n )
+    return NULL;
+
+  if ( x[0] == x[1] ) {
+    k = 2;
+    l = 1;
+  } else {
+    k = 1;
+    l = 2;
+  }
+
+  j = 0;
+  while ( j <= n-m ) {
+    if (x[1] != y[j+1]) {
+      j += k;
+    } else {
+      if ( !memcmp(x+2, y+j+2, m-2) && x[0] == y[j] )
+	return (void *)&y[j];
+      j += l;
+    }
+  }
+
+  return NULL;
+}
+#endif
+
 enum {
 	NEW_SONG,
 	END_SONG,

Modified: trunk/src/Driver.cs
==============================================================================
--- trunk/src/Driver.cs	(original)
+++ trunk/src/Driver.cs	Sun Mar 30 16:21:00 2008
@@ -75,7 +75,10 @@
 			string username;
 			string password;
 
-			Driver.SetProcessName ("last-exit");
+			try {
+				Driver.SetProcessName ("last-exit");
+			} catch {} // Ignore exception if fail (not needed to run)
+
 			Catalog.Init("last-exit", Defines.LOCALE_DIR);
 			Application.Init("last-exit", ref args);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]