[monkey-bubble: 81/753] New macro. (LISTLEN): Use it. (metadata_set): Use new macros. Compute



commit c3654c8d1fefc6967584293ba688828e790e60be
Author: Tom Tromey <tromey cygnus com>
Date:   Wed Sep 9 06:47:11 1998 +0000

    New macro. (LISTLEN): Use it. (metadata_set): Use new macros. Compute
    
    Wed Sep  9 00:01:56 1998  Tom Tromey  <tromey cygnus com>
    
    	* libgnome/gnome-metadata.c (LIST): New macro.
    	(LISTLEN): Use it.
    	(metadata_set): Use new macros.  Compute special key length
    	correctly.
    	(metadata_remove): Likewise.
    	(metadata_get_list): Likewise.
    	(metadata_remove): Correctly handle error when deleting record.
    
    Tue Sep  8 14:09:22 1998  Tom Tromey  <tromey cygnus com>
    
    	* libgnome/Makefile.am (bin_PROGRAMS): Added gnome-dump-metadata.
    	(gnome_dump_metadata_SOURCES): New macro
    	(gnome_dump_metadata_LDADD): New macro.
    
    	* libgnome/gnome-dump.c: New file.
    
    	* libgnome/gnome-metadata.c (init): Changed return value and all
    	callers.
    	(lock): New function.
    	(unlock): Likewise.
    	(lock_count): New global.
    	(worker): Lock and unlock database.
    	(gnome_metadata_get): Likewise.
    	(gnome_metadata_get_fast): Likewise.
    	(metadata_get_list): Likewise.
    	(metadata_remove): Likewise.
    	(metadata_set): Likewise.
    	(metadata_get_no_dup): Likewise.
    
    	* configure.in: Add -ldb to GNOME_LIBS and LIBGNOME_LIBS.  If db
    	checks fail, then configure fails.
    
    	* libgnome/gnome-metadata.h (GnomeMetadataError_t): New enum.
    	* libgnome/gnome-metadata.c (init): Wrote.
    	(gnome_metadata_db_file_name): New global.
    
    	* libgnome/gnome-score.c (log_score): Removed unused variable.
    	Don't use `%as', as that is not ANSI C.
    
    	* libgnome/libgnomeP.h: Added gnome-regex.h, gnome-metadata.h,
    	gnome-help.h.
    	* libgnome/libgnome.h: Added gnome-regex.h, gnome-metadata.h.
    	* libgnome/Makefile.am (libgnome_la_SOURCES): Added gnome-regex.c,
    	gnome-metadata.c.
    	(libgnomeinclude_HEADERS): Added gnome-regex.h, gnome-metadata.h.
    	* libgnome/gnome-regex.c: New file.
    	* libgnome/gnome-regex.h: New file.
    
    Sat Sep  5 19:37:17 1998  Tom Tromey  <tromey cygnus com>
    
    	* libgnome/gnome-metadata.c (metadata_set): Finished.
    	(try_regexps): Wrote.
    	(metadata_remove): Finished.

 libgnome/gnome-score.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libgnome/gnome-score.c b/libgnome/gnome-score.c
index 23293b8..da4010d 100644
--- a/libgnome/gnome-score.c
+++ b/libgnome/gnome-score.c
@@ -87,18 +87,18 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 {
    FILE *infile;
    FILE *outfile;
-   gchar buf[512], *buf2;
+   gchar buf[512], name[512];
    GList *scores = NULL, *anode;
-   gchar *name, *game_score_file;
+   gchar *game_score_file;
    gfloat ascore;
    time_t atime;
    struct ascore_t *anitem, *curscore;
    int i;
    gint retval = 1;
    gint pos;
-   
+
    game_score_file = gnome_get_score_file_name (progname, level);
-   
+
    infile = fopen (game_score_file, "r");
    if (infile)
      {
@@ -108,7 +108,7 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 	     while (isspace (buf[i]))
 	       buf[i--] = '\0';
 
-	     if(sscanf(buf, "%f %ld %as", &ascore, &atime, &name) != 3)
+	     if(sscanf(buf, "%f %ld %s", &ascore, &atime, name) != 3)
 	       break;
 
 	     g_message("Got score %f time %ld name %s",
@@ -116,7 +116,7 @@ log_score (const gchar * progname, const gchar * level, gchar * username,
 
 	     anitem = g_new(struct ascore_t, 1);
 	     anitem->score = ascore;
-	     anitem->username = name;
+	     anitem->username = g_strdup (name);
 	     anitem->scoretime = atime;
 	     scores = g_list_append (scores, (gpointer) anitem);
 	  }



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