OpenSync  0.22
Functions

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. More...
 
osync_bool osync_file_write (const char *filename, const char *data, int size, int mode, OSyncError **oserror)
 Writes data to a file. More...
 
osync_bool osync_file_read (const char *filename, char **data, int *size, OSyncError **oserror)
 Reads a file. More...
 
const char * osync_get_version (void)
 Returns the version of opensync. More...
 
void * osync_try_malloc0 (unsigned int size, OSyncError **error)
 Safely tries to malloc memory. More...
 
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
docPointer to a xmldoc
curThe pointer to the first node
pathThe path of the document
topentrythe name of the top node
errorPointer 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
filenameWhere to save the data
dataPointer to the data
sizeSize of the data
modeThe mode to set on the file
oserrorPointer 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
filenameWhere to read the data from
dataPointer to the data
sizeSize of the data
oserrorPointer 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
sizeThe size in bytes to malloc
errorThe 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_get_message(), osync_queue_new(), osync_try_malloc0(), and osync_user_new().