OpenSync Misc
[OpenSync Public API]

Some helper functions. More...


Functions

osync_bool _osync_open_xml_file (xmlDocPtr *doc, xmlNodePtr *cur, const char *path, const char *topentry, OSyncError **error)
 Opens a xml document.
osync_bool osync_file_write (const char *filename, const char *data, int size, int mode, OSyncError **oserror)
 Writes data to a file.
osync_bool osync_file_read (const char *filename, char **data, int *size, OSyncError **oserror)
 Reads a file.
const char * osync_get_version (void)
 Returns the version of opensync.
void * osync_try_malloc0 (unsigned int size, OSyncError **error)
 Safely tries to malloc memory.
char * osync_strreplace (const char *input, const char *delimiter, const char *replacement)


Detailed Description

Some helper functions.

Function Documentation

osync_bool _osync_open_xml_file ( xmlDocPtr *  doc,
xmlNodePtr *  cur,
const char *  path,
const char *  topentry,
OSyncError **  error 
)

Opens a xml document.

Opens a xml document

Parameters:
doc Pointer to a xmldoc
cur The pointer to the first node
path The path of the document
topentry the name of the top node
error Pointer to a error struct
Returns:
TRUE if successfull, FALSE otherwise

Definition at line 652 of file opensync_env.c.

Referenced by osync_group_load(), and osync_member_load().

osync_bool osync_file_write ( const char *  filename,
const char *  data,
int  size,
int  mode,
OSyncError **  oserror 
)

Writes data to a file.

Writes data to a file

Parameters:
filename Where to save the data
data Pointer to the data
size Size of the data
mode The mode to set on the file
oserror Pointer to a error struct
Returns:
TRUE if successfull, FALSE otherwise

Definition at line 700 of file opensync_env.c.

Referenced by osync_member_save().

osync_bool osync_file_read ( const char *  filename,
char **  data,
int *  size,
OSyncError **  oserror 
)

Reads a file.

Reads a file

Parameters:
filename Where to read the data from
data Pointer to the data
size Size of the data
oserror Pointer to a error struct
Returns:
TRUE if successfull, FALSE otherwise

Definition at line 743 of file opensync_env.c.

Referenced by osync_member_get_config(), and osync_member_get_config_or_default().

const char* osync_get_version ( void   ) 

Returns the version of opensync.

Returns a string identifying the major and minor version of opensync (something like "0.11")

Returns:
String with version

Definition at line 781 of file opensync_env.c.

void* osync_try_malloc0 ( unsigned int  size,
OSyncError **  error 
)

Safely tries to malloc memory.

Tries to malloc memory but returns an error in an OOM situation instead of aborting

Parameters:
size The size in bytes to malloc
error The error which will hold the info in case of an error
Returns:
A pointer to the new memory or NULL in case of error

Definition at line 796 of file opensync_env.c.

Referenced by osync_message_new(), osync_queue_new(), and osync_user_new().


Generated on Sun Jul 26 17:47:24 2009 for OpenSync by  doxygen 1.5.9