[babl] babl: make utility file reading function non-static
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: make utility file reading function non-static
- Date: Wed, 13 Sep 2017 16:09:06 +0000 (UTC)
commit 3b7fc88e1dc173092921474051c6971cf4d6e5a4
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Sep 13 15:10:07 2017 +0200
babl: make utility file reading function non-static
babl/babl-cache.c | 41 +----------------------------------------
babl/babl-internal.h | 4 ++++
babl/babl-util.c | 39 +++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 40 deletions(-)
---
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index 2b25628..0200a11 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -195,45 +195,6 @@ void babl_store_db (void)
free (tmpp);
}
-static int
-babl_file_get_contents (const char *path,
- char **contents,
- long *length,
- void *error)
-{
- FILE *file;
- long size;
- char *buffer;
-
- file = fopen (path,"rb");
-
- if (!file)
- return -1;
-
- fseek (file, 0, SEEK_END);
- size = ftell (file);
- if (length) *length = size;
- rewind (file);
- buffer = calloc(size + 8, 1);
-
- if (!buffer)
- {
- fclose(file);
- return -1;
- }
-
- size -= fread (buffer, 1, size, file);
- if (size)
- {
- fclose (file);
- free (buffer);
- return -1;
- }
- fclose (file);
- *contents = buffer;
- return 0;
-}
-
int
_babl_fish_path_destroy (void *data);
@@ -259,7 +220,7 @@ void babl_init_db (void)
if (getenv ("BABL_DEBUG_CONVERSIONS"))
return;
- babl_file_get_contents (path, &contents, &length, NULL);
+ _babl_file_get_contents (path, &contents, &length, NULL);
if (!contents)
return;
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 7bf0544..a4dc5f7 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -424,5 +424,9 @@ const Babl * babl_trc_gamma (double gamma);
*/
const Babl * babl_trc (const char *name);
+int _babl_file_get_contents (const char *path,
+ char **contents,
+ long *length,
+ void *error);
#endif
diff --git a/babl/babl-util.c b/babl/babl-util.c
index 01a5e97..9b08913 100644
--- a/babl/babl-util.c
+++ b/babl/babl-util.c
@@ -99,3 +99,42 @@ babl_rel_avg_error (const double *imgA,
return error;
}
+int
+_babl_file_get_contents (const char *path,
+ char **contents,
+ long *length,
+ void *error)
+{
+ FILE *file;
+ long size;
+ char *buffer;
+
+ file = fopen (path,"rb");
+
+ if (!file)
+ return -1;
+
+ fseek (file, 0, SEEK_END);
+ size = ftell (file);
+ if (length) *length = size;
+ rewind (file);
+ buffer = calloc(size + 8, 1);
+
+ if (!buffer)
+ {
+ fclose(file);
+ return -1;
+ }
+
+ size -= fread (buffer, 1, size, file);
+ if (size)
+ {
+ fclose (file);
+ free (buffer);
+ return -1;
+ }
+ fclose (file);
+ *contents = buffer;
+ return 0;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]