From: <svn...@op...> - 2009-03-25 22:48:44
|
Author: dgollub Date: Wed Mar 25 23:48:38 2009 New Revision: 5317 URL: http://www.opensync.org/changeset/5317 Log: Define how the memory of the format plugin "print" function must get allocated and freed. fixes #1028 Modified: trunk/opensync/data/opensync_data.h trunk/opensync/format/opensync_objformat.h Modified: trunk/opensync/data/opensync_data.h ============================================================================== --- trunk/opensync/data/opensync_data.h Wed Mar 25 22:37:09 2009 (r5316) +++ trunk/opensync/data/opensync_data.h Wed Mar 25 23:48:38 2009 (r5317) @@ -119,7 +119,7 @@ * objects they should specify a print function. * * @param data The data to get printable - * @return A string describing the object + * @return A string describing the object which must be freed by the caller with osync_free() */ OSYNC_EXPORT char *osync_data_get_printable(OSyncData *data); Modified: trunk/opensync/format/opensync_objformat.h ============================================================================== --- trunk/opensync/format/opensync_objformat.h Wed Mar 25 22:37:09 2009 (r5316) +++ trunk/opensync/format/opensync_objformat.h Wed Mar 25 23:48:38 2009 (r5317) @@ -180,6 +180,9 @@ * describing the object as closely as possible. This information will be * used by the user to decide which object to pick when there is a conflict. * + * The print_func returns a humand readable string (with terminating \0) and + * memory must be allocated with osync_try_malloc0(), osync_strdup*(). + * * @param format Pointer to the object format * @param print_func The print function to use */ @@ -252,7 +255,7 @@ * @param format Pointer to the object format * @param data Pointer to the object to destroy * @param size Size in bytes of the object specified by the data parameter - * @returns Human readable string of the specified object. Caller is responsible for freeing the string. + * @returns Human readable string of the specified object. Caller is responsible for freeing the string with osync_free(). * Or NULL if size is 0 or data NULL. */ OSYNC_EXPORT char *osync_objformat_print(OSyncObjFormat *format, const char *data, unsigned int size); |