diff src/xs_length.c @ 99:2bc56809ec0b

STIL-support fixes, variable renaming
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 10 Jan 2004 23:51:04 +0000
parents 3898d4fdbd49
children 002e314712c4
line wrap: on
line diff
--- a/src/xs_length.c	Sat Jan 10 22:56:04 2004 +0000
+++ b/src/xs_length.c	Sat Jan 10 23:51:04 2004 +0000
@@ -39,7 +39,7 @@
 /*
  * Hash-database handling functions
  */
-t_xs_sldb_node *xs_db_node_new(void)
+t_xs_sldb_node *xs_sldb_node_new(void)
 {
  t_xs_sldb_node *pResult;
  
@@ -51,7 +51,7 @@
 }
 
 
-void xs_db_node_free(t_xs_sldb_node *pNode)
+void xs_sldb_node_free(t_xs_sldb_node *pNode)
 {
  if (pNode) g_free(pNode);
 }
@@ -64,7 +64,7 @@
 #define LTHIS	(pNode)
 #define LNEXT	(pNode->pNext)
 
-void xs_db_node_insert(t_xs_sldb_node *pNode)
+void xs_sldb_node_insert(t_xs_sldb_node *pNode)
 {
  if (xs_sldb)
  	{
@@ -87,7 +87,7 @@
  *         negative if testHash1 < testHash2
  *         positive if testHash1 > testHash2
  */
-gint xs_db_cmphash(t_xs_md5hash testHash1, t_xs_md5hash testHash2)
+gint xs_sldb_cmphash(t_xs_md5hash testHash1, t_xs_md5hash testHash2)
 {
  register gint i, res = 0;
   
@@ -102,7 +102,7 @@
 /*
  * Get song length from database
  */
-t_xs_sldb_node * xs_db_get(t_xs_md5hash pHash)
+t_xs_sldb_node * xs_sldb_get(t_xs_md5hash pHash)
 {
  gint iStartNode, iEndNode, iQNode, r, i;
  gboolean iFound;
@@ -121,7 +121,7 @@
 
  while ((!iFound) && ((iEndNode - iStartNode) > 128))
  	{
- 	r = xs_db_cmphash(pHash, xs_sldbi[iQNode]->md5Hash);
+ 	r = xs_sldb_cmphash(pHash, xs_sldbi[iQNode]->md5Hash);
  	if (r < 0)
  		{
  		/* Hash was in the <- LEFT side */
@@ -145,7 +145,7 @@
 	i = iStartNode;
 	while ((i <= iEndNode) && (!iFound))
 		{
-		if (xs_db_cmphash(pHash, xs_sldbi[i]->md5Hash) == 0)
+		if (xs_sldb_cmphash(pHash, xs_sldbi[i]->md5Hash) == 0)
 			iFound = TRUE;
 			else
 			i++;
@@ -207,7 +207,7 @@
 /*
  * Read database to memory
  */
-gint xs_db_read(gchar *dbFilename)
+gint xs_sldb_read(gchar *dbFilename)
 {
  FILE *inFile;
  gchar inLine[XS_BUFSIZE];
@@ -243,7 +243,7 @@
 	dbFilename, lineNum);
 	} else {
 	/* Allocate new node */
-	if ((tmpNode = xs_db_node_new()) == NULL)
+	if ((tmpNode = xs_sldb_node_new()) == NULL)
 		{
 		XSERR("Error allocating new node. Fatal error.\n");
 		exit(5);
@@ -271,7 +271,7 @@
 		XSERR("'=' expected in SongLengthDB file '%s' line #%d, column #%d\n",
 		dbFilename, lineNum, linePos);
 
-		xs_db_node_free(tmpNode);
+		xs_sldb_node_free(tmpNode);
 		} else {
 		/* First playtime is after '=' */
 		linePos++;
@@ -292,9 +292,9 @@
 
 		/* Add an node to db in memory */
 		if (iOK)
-			xs_db_node_insert(tmpNode);
+			xs_sldb_node_insert(tmpNode);
 			else
-			xs_db_node_free(tmpNode);
+			xs_sldb_node_free(tmpNode);
 		}
 	}
 	}
@@ -317,10 +317,10 @@
 /*
  * Compare two nodes' hashes
  */
-gint xs_db_cmp(const void *pNode1, const void *pNode2)
+gint xs_sldb_cmp(const void *pNode1, const void *pNode2)
 {
  /* We assume here that we never ever get NULL-pointers or similar */
- return xs_db_cmphash((*(t_xs_sldb_node **) pNode1)->md5Hash,
+ return xs_sldb_cmphash((*(t_xs_sldb_node **) pNode1)->md5Hash,
                       (*(t_xs_sldb_node **) pNode2)->md5Hash);
 }
 
@@ -339,7 +339,7 @@
  if (!xs_cfg.songlenDBPath)
  	return -10;
 
- if (xs_db_read(xs_cfg.songlenDBPath) < 0)
+ if (xs_sldb_read(xs_cfg.songlenDBPath) < 0)
  	return -9;
 
 XSDEBUG("indexing...\n");
@@ -370,7 +370,7 @@
 		}
 
 	/* Sort the indexes */
-	qsort(xs_sldbi, xs_sldbn, sizeof(t_xs_sldb_node *), xs_db_cmp);
+	qsort(xs_sldbi, xs_sldbn, sizeof(t_xs_sldb_node *), xs_sldb_cmp);
 	}
 
  /* OK */
@@ -392,7 +392,7 @@
  while (pCurr)
  	{
  	pNext = pCurr->pNext;
-	xs_db_node_free(pCurr);
+	xs_sldb_node_free(pCurr);
  	pCurr = pNext;
  	}
 
@@ -567,7 +567,7 @@
 	/* Get the hash and then look up from db */
 	if (xs_get_sid_hash(pcFilename, dbHash) == 0)
 		{
-		pResult = xs_db_get(dbHash);
+		pResult = xs_sldb_get(dbHash);
 		}
 	}