diff --git a/ChangeLog b/ChangeLog index 1b1db74c20..068545a58a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-08-20 Dave Peticolas + + * src/engine/gnc-book-p.h: add const + + * src/engine/gnc-book.c: strdup error message for backend + + * src/backend/file/gnc-backend-file.c: fix bugs + 2001-08-19 Christian Stimming * po/gnc-glossary.txt, po/glossary/gnc-glossary.txt, diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index 86a5621176..a4c57c51b8 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -62,9 +62,10 @@ static void file_book_begin(Backend *be_start, GNCBook *book, const char *book_id, gboolean ignore_lock, gboolean create_if_nonexistent) { + FileBackend* be; char *dirname; char *p; - FileBackend* be; + ENTER (" "); be = (FileBackend*)be_start; @@ -73,7 +74,7 @@ file_book_begin(Backend *be_start, GNCBook *book, const char *book_id, /* Make sure the directory is there */ dirname = g_strdup (book->fullpath); - be->fullpath = book->fullpath; + be->fullpath = g_strdup (book->fullpath); p = strrchr (dirname, '/'); if (p && p != dirname) { diff --git a/src/engine/gnc-book-p.h b/src/engine/gnc-book-p.h index 691df316d0..76f1750947 100644 --- a/src/engine/gnc-book-p.h +++ b/src/engine/gnc-book-p.h @@ -95,7 +95,8 @@ void gnc_book_set_pricedb(GNCBook *book, GNCPriceDB *db); void gnc_book_mark_saved(GNCBook *book); -void gnc_book_push_error (GNCBook *book, GNCBackendError err, char *message); +void gnc_book_push_error (GNCBook *book, GNCBackendError err, + const char *message); Backend* gncBackendInit_file(const char *book_id, void *data); diff --git a/src/engine/gnc-book.c b/src/engine/gnc-book.c index f219450cd4..d460ed3872 100644 --- a/src/engine/gnc-book.c +++ b/src/engine/gnc-book.c @@ -66,18 +66,19 @@ static void gnc_book_clear_error (GNCBook *book) { book->last_err = ERR_BACKEND_NO_ERR; - if(book->error_message) - { - g_free(book->error_message); - book->error_message = NULL; - } + g_free(book->error_message); + book->error_message = NULL; } void -gnc_book_push_error (GNCBook *book, GNCBackendError err, char *message) +gnc_book_push_error (GNCBook *book, GNCBackendError err, const char *message) { + if (!book) return; + + g_free (book->error_message); + book->last_err = err; - book->error_message = message; + book->error_message = g_strdup (message); } GNCBackendError