diff src/xs_length.c @ 56:6a3ce7260ae1

Changed some standard functions to glib ones
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2003 00:17:04 +0000
parents 1788f4ce6a44
children 85811bcd049e
line wrap: on
line diff
--- a/src/xs_length.c	Sat Jun 21 22:11:02 2003 +0000
+++ b/src/xs_length.c	Sun Jun 22 00:17:04 2003 +0000
@@ -45,7 +45,7 @@
  t_xs_dbentry *pResult;
  
  /* Allocate memory for new node */
- pResult = (t_xs_dbentry *) calloc(1, sizeof(t_xs_dbentry));
+ pResult = (t_xs_dbentry *) g_malloc0(sizeof(t_xs_dbentry));
  if (pResult == NULL) return NULL;
  
  return pResult;
@@ -325,13 +325,9 @@
  if (xs_cfg.songlenDBPath == NULL)
  	return -10;
 
-fprintf(stderr, "reading '%s'\n", xs_cfg.songlenDBPath);
-
  if (xs_db_read(xs_cfg.songlenDBPath, &xs_database) < 0)
  	return -9;
 
-fprintf(stderr, "read_done, now size DB for index\n");
-
  /* Get size of db */
  pCurr = xs_database;
  xs_dbnodes = 0;
@@ -344,9 +340,8 @@
  /* Check number of nodes */
  if (xs_dbnodes > 0)
 	{
-fprintf(stderr, "allocating %i nodes...\n", xs_dbnodes);
 	/* Allocate memory for index-table */
-	xs_dbindex = (t_xs_dbentry **) malloc(sizeof(t_xs_dbentry *) * xs_dbnodes);
+	xs_dbindex = (t_xs_dbentry **) g_malloc(sizeof(t_xs_dbentry *) * xs_dbnodes);
 	if (xs_dbindex == NULL) return -6;
 
 	/* Get node-pointers to table */
@@ -358,7 +353,6 @@
 		pCurr = pCurr->pNext;
 		}
 
-fprintf(stderr, "sorting!\n");
 	/* Sort the indexes */
 	qsort(xs_dbindex, xs_dbnodes, sizeof(t_xs_dbentry *), xs_db_cmp);
 	}
@@ -487,7 +481,7 @@
  fseek(inFile, psidH.dataOffset, SEEK_SET);
 
  /* Allocate memory */ 
- songData = (guint8 *) malloc(sizeof(guint8) * songDataLen);
+ songData = (guint8 *) g_malloc(sizeof(guint8) * songDataLen);
  if (songData == NULL)
  	{
  	fclose(inFile);
@@ -575,8 +569,9 @@
   			}
   		}
 	}
-
-// XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult);
+#if 0
+ XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult);
+#endif
   
  return iResult;
 }