mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix lots of splint issues (including memory leaks). This includes some changes
in qof and gnc files adding annotation comments to help splint analyze ownership of memory and objects. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17983 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -183,7 +183,7 @@ const gchar * guid_to_string (const GUID * guid);
|
||||
*
|
||||
* @return A pointer to the terminating null character of the string.
|
||||
*/
|
||||
gchar * guid_to_string_buff (const GUID * guid, gchar *buff);
|
||||
gchar * guid_to_string_buff (const GUID * guid, /*@ out @*/ gchar *buff);
|
||||
|
||||
|
||||
/** Given a string, decode the id into the guid if guid is non-NULL.
|
||||
@@ -191,7 +191,7 @@ gchar * guid_to_string_buff (const GUID * guid, gchar *buff);
|
||||
* hexadecimal number. This function accepts both upper and lower case
|
||||
* hex digits. If the return value is FALSE, the effect on guid is
|
||||
* undefined. */
|
||||
gboolean string_to_guid(const gchar * string, GUID * guid);
|
||||
gboolean string_to_guid(const gchar * string, /*@ out @*/ GUID * guid);
|
||||
|
||||
|
||||
/** Given two GUIDs, return TRUE if they are non-NULL and equal.
|
||||
|
||||
@@ -373,7 +373,7 @@ KvpValue * kvp_frame_get_value(const KvpFrame *frame, const gchar *path);
|
||||
* @return The KvpFrame at the specified path, or NULL if it doesn't
|
||||
* exist.
|
||||
*/
|
||||
KvpFrame * kvp_frame_get_frame(const KvpFrame *frame, const gchar *path);
|
||||
/*@ dependent @*/ KvpFrame * kvp_frame_get_frame(const KvpFrame *frame, const gchar *path);
|
||||
|
||||
/** This routine returns the last frame of the path.
|
||||
* If the frame path doesn't exist, it is created.
|
||||
@@ -641,7 +641,7 @@ GList * kvp_value_get_glist(const KvpValue * value);
|
||||
|
||||
/** Value accessor. This one is non-copying -- the caller can modify
|
||||
* the value directly. */
|
||||
KvpFrame * kvp_value_get_frame(const KvpValue * value);
|
||||
/*@ dependent @*/ KvpFrame * kvp_value_get_frame(const KvpValue * value);
|
||||
Timespec kvp_value_get_timespec(const KvpValue * value);
|
||||
|
||||
/**
|
||||
|
||||
@@ -241,12 +241,12 @@
|
||||
struct QofBackendProvider_s
|
||||
{
|
||||
/** Some arbitrary name given for this particular backend provider */
|
||||
const char * provider_name;
|
||||
/*@ observer @*/ const char * provider_name;
|
||||
|
||||
/** The access method that this provider provides, for example,
|
||||
* file:// http:// postgres:// or sqlite://, but without the :// at the end
|
||||
*/
|
||||
const char * access_method;
|
||||
/*@ observer @*/ const char * access_method;
|
||||
|
||||
/** \brief Partial QofBook handler
|
||||
|
||||
@@ -277,10 +277,10 @@ struct QofBackendProvider_s
|
||||
types match the incoming data. The backend should not assume that
|
||||
returning TRUE will mean that the data will naturally follow.
|
||||
*/
|
||||
gboolean (*check_data_type) (const char*);
|
||||
/*@ null @*/ gboolean (*check_data_type) (const char*);
|
||||
|
||||
/** Free this structure, unregister this backend handler. */
|
||||
void (*provider_free) (QofBackendProvider *);
|
||||
void (*provider_free) (/*@ only @*/ QofBackendProvider *);
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -296,9 +296,9 @@ struct QofBackend_s
|
||||
gboolean ignore_lock,
|
||||
gboolean create_if_nonexistent);
|
||||
void (*session_end) (QofBackend *);
|
||||
void (*destroy_backend) (QofBackend *);
|
||||
void (*destroy_backend) (/*@ only @*/ QofBackend *);
|
||||
|
||||
void (*load) (QofBackend *, QofBook *, QofBackendLoadType);
|
||||
void (*load) (QofBackend *, /*@ dependent @*/ QofBook *, QofBackendLoadType);
|
||||
|
||||
void (*begin) (QofBackend *, QofInstance *);
|
||||
void (*commit) (QofBackend *, QofInstance *);
|
||||
@@ -308,9 +308,9 @@ struct QofBackend_s
|
||||
void (*free_query) (QofBackend *, gpointer);
|
||||
void (*run_query) (QofBackend *, gpointer);
|
||||
|
||||
void (*sync) (QofBackend *, QofBook *);
|
||||
void (*sync) (QofBackend *, /*@ dependent @*/ QofBook *);
|
||||
void (*load_config) (QofBackend *, KvpFrame *);
|
||||
KvpFrame* (*get_config) (QofBackend *);
|
||||
/*@ observer @*/ KvpFrame* (*get_config) (QofBackend *);
|
||||
gint64 (*counter) (QofBackend *, const char *counter_name);
|
||||
|
||||
gboolean (*events_pending) (QofBackend *);
|
||||
@@ -370,7 +370,7 @@ struct QofBackend_s
|
||||
* backend library may register more than one provider, if it is
|
||||
* capable of handling more than one URL access method.
|
||||
*/
|
||||
void qof_backend_register_provider (QofBackendProvider *);
|
||||
void qof_backend_register_provider (/*@ only @*/ QofBackendProvider *);
|
||||
|
||||
/** The qof_backend_set_message() assigns a string to the backend error message.
|
||||
*/
|
||||
|
||||
@@ -158,7 +158,7 @@ typedef struct QofBackendProvider_s QofBackendProvider;
|
||||
typedef struct QofBackend_s QofBackend;
|
||||
|
||||
/** \brief DOCUMENT ME! */
|
||||
typedef void (*QofBePercentageFunc) (const char *message, double percent);
|
||||
typedef void (*QofBePercentageFunc) (/*@ null @*/ const char *message, double percent);
|
||||
|
||||
/** @name Allow access to the begin routine for this backend. */
|
||||
//@{
|
||||
|
||||
@@ -175,7 +175,7 @@ void qof_book_mark_closed (QofBook *book);
|
||||
* a non-NULL value. (Unless the system malloc failed (out of
|
||||
* memory) in which case what happens??).
|
||||
*/
|
||||
QofCollection * qof_book_get_collection (const QofBook *, QofIdType);
|
||||
/*@ dependent @*/ QofCollection * qof_book_get_collection (const QofBook *, QofIdType);
|
||||
|
||||
/** Invoke the indicated callback on each collection in the book. */
|
||||
typedef void (*QofCollectionForeachCB) (QofCollection *, gpointer user_data);
|
||||
|
||||
@@ -142,14 +142,14 @@ typedef struct _QofParam QofParam;
|
||||
* also provides a place for the user to hang additional user-defined
|
||||
* data.
|
||||
*/
|
||||
typedef gpointer (*QofAccessFunc)(gpointer object, const QofParam *param);
|
||||
typedef gpointer (*QofAccessFunc)(gpointer object, /*@ null @*/ const QofParam *param);
|
||||
|
||||
/** The QofSetterFunc defines an function pointer for parameter
|
||||
* setters. Real functions must be of the form:
|
||||
*
|
||||
* void setter_func (object_type *self, param_type *param);
|
||||
*/
|
||||
typedef void (*QofSetterFunc) (gpointer, gpointer);
|
||||
typedef void (*QofSetterFunc) (gpointer, /*@ null @*/ gpointer);
|
||||
|
||||
/* A callback for how to compare two (same-type) objects based on a
|
||||
* common getter (parameter member), using the provided comparison
|
||||
|
||||
@@ -168,7 +168,7 @@ void qof_collection_destroy (QofCollection *col);
|
||||
QofIdType qof_collection_get_type (const QofCollection *);
|
||||
|
||||
/** Find the entity going only from its guid */
|
||||
QofInstance * qof_collection_lookup_entity (const QofCollection *, const GUID *);
|
||||
/*@ dependent @*/ QofInstance * qof_collection_lookup_entity (const QofCollection *, const GUID *);
|
||||
|
||||
/** Callback type for qof_collection_foreach */
|
||||
typedef void (*QofInstanceForeachCB) (QofInstance *, gpointer user_data);
|
||||
|
||||
@@ -87,7 +87,7 @@ GType qof_instance_get_type(void);
|
||||
void qof_instance_init_data (QofInstance *, QofIdType, QofBook *);
|
||||
|
||||
/** Return the book pointer */
|
||||
QofBook *qof_instance_get_book (gconstpointer);
|
||||
/*@ dependent @*/ QofBook *qof_instance_get_book (gconstpointer);
|
||||
|
||||
/** Set the book pointer */
|
||||
void qof_instance_set_book (gconstpointer inst, QofBook *book);
|
||||
@@ -99,14 +99,14 @@ void qof_instance_copy_book (gpointer ptr1, gconstpointer ptr2);
|
||||
gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2);
|
||||
|
||||
/** Return the GUID of this instance */
|
||||
const GUID * qof_instance_get_guid (gconstpointer);
|
||||
/*@ dependent @*/ const GUID * qof_instance_get_guid (gconstpointer);
|
||||
|
||||
/** \deprecated Use qof_instance_get_guid instead.
|
||||
* Works like qof_instance_get_guid, but returns NULL on NULL */
|
||||
const GUID * qof_entity_get_guid (gconstpointer);
|
||||
/*@ dependent @*/ const GUID * qof_entity_get_guid (gconstpointer);
|
||||
|
||||
/** Return the collection this instance belongs to */
|
||||
QofCollection* qof_instance_get_collection (gconstpointer inst);
|
||||
/*@ dependent @*/ QofCollection* qof_instance_get_collection (gconstpointer inst);
|
||||
|
||||
/** Set the GUID of this instance */
|
||||
void qof_instance_set_guid (gpointer inst, const GUID *guid);
|
||||
@@ -125,7 +125,7 @@ gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr
|
||||
//void qof_instance_set_e_type (QofInstance *ent, QofIdType e_type);
|
||||
|
||||
/** Return the pointer to the kvp_data */
|
||||
KvpFrame* qof_instance_get_slots (const QofInstance *);
|
||||
/*@ dependent @*/ KvpFrame* qof_instance_get_slots (const QofInstance *);
|
||||
|
||||
/** Return the last time this instance was modified. If QofInstances
|
||||
* are used with the QofObject storage backends, then the instance
|
||||
|
||||
@@ -199,7 +199,7 @@ void qof_log_set_default(QofLogLevel log_level);
|
||||
|
||||
/** Print a function entry debugging message */
|
||||
#define ENTER(format, args...) do { \
|
||||
if (qof_log_check(log_module, G_LOG_LEVEL_DEBUG)) { \
|
||||
if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
|
||||
g_log (log_module, G_LOG_LEVEL_DEBUG, \
|
||||
"[enter %s:%s()] " format, __FILE__, \
|
||||
PRETTY_FUNC_NAME , ## args); \
|
||||
@@ -221,7 +221,7 @@ void qof_log_set_default(QofLogLevel log_level);
|
||||
|
||||
/** Print a function exit debugging message. **/
|
||||
#define LEAVE(format, args...) do { \
|
||||
if (qof_log_check(log_module, G_LOG_LEVEL_DEBUG)) { \
|
||||
if (qof_log_check(log_module, (QofLogLevel)G_LOG_LEVEL_DEBUG)) { \
|
||||
qof_log_dedent(); \
|
||||
g_log (log_module, G_LOG_LEVEL_DEBUG, \
|
||||
"[leave %s()] " format, \
|
||||
|
||||
@@ -167,7 +167,7 @@ gboolean qof_object_register_backend (QofIdTypeConst type_name,
|
||||
const char *backend_name,
|
||||
gpointer be_data);
|
||||
|
||||
gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
|
||||
/*@ dependent @*/ gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
|
||||
const char *backend_name);
|
||||
|
||||
void qof_object_foreach_backend (const char *backend_name,
|
||||
|
||||
@@ -43,10 +43,10 @@ int qof_query_get_max_results (const QofQuery *q);
|
||||
* Note that you should NOT modify this list in any way. It belongs
|
||||
* to the query.
|
||||
*/
|
||||
GList * qof_query_get_terms (const QofQuery *q);
|
||||
/*@ dependent @*/ GList * qof_query_get_terms (const QofQuery *q);
|
||||
|
||||
GSList * qof_query_term_get_param_path (const QofQueryTerm *queryterm);
|
||||
QofQueryPredData *qof_query_term_get_pred_data (const QofQueryTerm *queryterm);
|
||||
/*@ dependent @*/ GSList * qof_query_term_get_param_path (const QofQueryTerm *queryterm);
|
||||
/*@ dependent @*/ QofQueryPredData *qof_query_term_get_pred_data (const QofQueryTerm *queryterm);
|
||||
gboolean qof_query_term_is_inverted (const QofQueryTerm *queryterm);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ gboolean qof_query_term_is_inverted (const QofQueryTerm *queryterm);
|
||||
void qof_query_get_sorts (QofQuery *q, QofQuerySort **primary,
|
||||
QofQuerySort **secondary, QofQuerySort **tertiary);
|
||||
|
||||
GSList * qof_query_sort_get_param_path (const QofQuerySort *querysort);
|
||||
/*@ dependent @*/ GSList * qof_query_sort_get_param_path (const QofQuerySort *querysort);
|
||||
gint qof_query_sort_get_sort_options (const QofQuerySort *querysort);
|
||||
gboolean qof_query_sort_get_increasing (const QofQuerySort *querysort);
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2);
|
||||
void qof_query_print (QofQuery *query);
|
||||
|
||||
/** Return the type of data we're querying for */
|
||||
QofIdType qof_query_get_search_for (const QofQuery *q);
|
||||
/*@ dependent @*/ QofIdType qof_query_get_search_for (const QofQuery *q);
|
||||
|
||||
/** Return the list of books we're using */
|
||||
GList * qof_query_get_books (QofQuery *q);
|
||||
|
||||
Reference in New Issue
Block a user