diff -urp xmms-sid-0.8.0beta17-org/src/xs_stil.c xmms-sid-0.8.0beta17/src/xs_stil.c
--- xmms-sid-0.8.0beta17-org/src/xs_stil.c	2007-01-26 15:17:59.000000000 +0200
+++ xmms-sid-0.8.0beta17/src/xs_stil.c	2007-01-27 21:49:52.000000000 +0200
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <stdarg.h>
+#include <search.h>
 
 
 /* Database handling functions
@@ -164,8 +165,7 @@ gint xs_stildb_read(t_xs_stildb *db, gch
 
 	/* Try to open the file */
 	if ((inFile = fopen(dbFilename, "ra")) == NULL) {
-		xs_error(_("Could not open STILDB '%s'\n"),
-			dbFilename);
+		xs_error(_("Could not open STILDB '%s'\n"), dbFilename);
 		return -1;
 	}
 
@@ -176,9 +176,8 @@ gint xs_stildb_read(t_xs_stildb *db, gch
 	tmpNode = NULL;
 	subEntry = 0;
 
-	while (!isError && !feof(inFile) && fgets(inLine, XS_BUF_SIZE, inFile)) {
-		size_t linePos, eolPos;
-		inLine[XS_BUF_SIZE - 1] = 0;
+	while (!isError && fgets(inLine, XS_BUF_SIZE, inFile) != NULL) {
+		guint linePos, eolPos;
 		linePos = eolPos = 0;
 		xs_findeol(inLine, &eolPos);
 		inLine[eolPos] = 0;
@@ -401,55 +400,27 @@ void xs_stildb_free(t_xs_stildb *db)
  */
 t_xs_stil_node *xs_stildb_get_node(t_xs_stildb *db, gchar *pcFilename)
 {
-	gint iStartNode, iEndNode, iQNode, r, i;
-	gboolean iFound;
-	t_xs_stil_node *pResult;
+	size_t n;
+	t_xs_stil_node keyitem;
+	t_xs_stil_node *key;
+	t_xs_stil_node **item;
 
 	/* Check the database pointers */
 	if (!db || !db->pNodes || !db->ppIndex)
 		return NULL;
 
 	/* Look-up via index using binary search */
-	pResult = NULL;
-	iStartNode = 0;
-	iEndNode = (db->n - 1);
-	iQNode = (iEndNode / 2);
-	iFound = FALSE;
-
-	while ((!iFound) && ((iEndNode - iStartNode) > XS_BIN_BAILOUT)) {
-		r = strcmp(pcFilename, db->ppIndex[iQNode]->pcFilename);
-		if (r < 0) {
-			/* Hash was in the <- LEFT side */
-			iEndNode = iQNode;
-			iQNode = iStartNode + ((iEndNode - iStartNode) / 2);
-		} else if (r > 0) {
-			/* Hash was in the RIGHT -> side */
-			iStartNode = iQNode;
-			iQNode = iStartNode + ((iEndNode - iStartNode) / 2);
-		} else
-			iFound = TRUE;
-	}
-
-	/* If not found already */
-	if (!iFound) {
-		/* Search the are linearly */
-		iFound = FALSE;
-		i = iStartNode;
-		while ((i <= iEndNode) && (!iFound)) {
-			if (strcmp(pcFilename, db->ppIndex[i]->pcFilename) == 0)
-				iFound = TRUE;
-			else
-				i++;
-		}
+	keyitem.pcFilename = pcFilename;
+	key = &keyitem;
+	n = db->n;
+	item = bsearch(&key, db->ppIndex, n, sizeof(db->ppIndex[0]), xs_stildb_cmp);
+	if (item)
+		return *item;
+
+	/* Assume the array may not have been sorted, so search linearly */
+	item = lfind(&key, db->ppIndex, &n, sizeof(db->ppIndex[0]), xs_stildb_cmp);
+	if (item)
+		return *item;
 
-		/* Check the result */
-		if (iFound)
-			pResult = db->ppIndex[i];
-
-	} else {
-		/* Found via binary search */
-		pResult = db->ppIndex[iQNode];
-	}
-
-	return pResult;
+	return NULL;
 }
