diff -r eca715c100fe -r 4e6e7cc6b50d bl/textfileutils.c --- a/bl/textfileutils.c Tue Jan 31 01:07:38 2012 +0000 +++ b/bl/textfileutils.c Sat Jul 20 11:07:02 2013 +0100 @@ -3,26 +3,21 @@ #include /* - * Read a file into memory (which should be freed with mem_free when no + * Read a file into memory (which should be freed with g_free when no * longer required). Returns NULL on error and outputs a suitable error * message to stderr. * DOS-style line endings and UTF-8 BOM are handled transparently even * on platforms which don't normally use these formats. */ gboolean file_get_contents_text(const char *filename,char **contents, - size_t *length) + size_t *length,GError **err) { int i; unsigned char *raw; - size_t raw_length; + gsize raw_length; GString *string; - GError *error=NULL; - if (!g_file_get_contents(filename,(char *)&raw,&raw_length,&error)) - { - fprintf(stderr,"%s: %s\n",filename,error->message); - g_error_free(error); + if (!g_file_get_contents(filename,(char **)&raw,&raw_length,err)) return FALSE; - } string=g_string_new(NULL); i=0; if (raw_length>=3 && raw[0]==0xEF && raw[1]==0xBB && raw[2]==0xBF)