@@ -744,25 +744,22 @@ vips__file_read(FILE *fp, const char *filename, size_t *length_out)
744
744
if (len == -1 ) {
745
745
int size ;
746
746
747
- /* Can't get length: read in chunks and realloc () to end of
747
+ /* Can't get length: read in chunks and g_realloc () to end of
748
748
* file.
749
749
*/
750
750
str = NULL ;
751
751
len = 0 ;
752
752
size = 0 ;
753
753
do {
754
- char * str2 ;
755
-
756
754
/* Again, a 1gb sanity limit.
757
755
*/
758
756
size += 1024 ;
759
- if (size > 1024 * 1024 * 1024 ||
760
- !(str2 = realloc (str , size ))) {
761
- free (str );
757
+ if (size > 1024 * 1024 * 1024 ) {
758
+ g_free (str );
762
759
vips_error ("vips__file_read" , "%s" , _ ("out of memory" ));
763
760
return NULL ;
764
761
}
765
- str = str2 ;
762
+ str = g_realloc ( str , size ) ;
766
763
767
764
/* -1 to allow space for an extra NULL we add later.
768
765
*/
@@ -958,8 +955,7 @@ vips__gslist_gvalue_copy(const GSList *list)
958
955
copy = NULL ;
959
956
960
957
for (p = list ; p ; p = p -> next )
961
- copy = g_slist_prepend (copy ,
962
- vips__gvalue_copy ((GValue * ) p -> data ));
958
+ copy = g_slist_prepend (copy , vips__gvalue_copy ((GValue * ) p -> data ));
963
959
964
960
copy = g_slist_reverse (copy );
965
961
@@ -992,8 +988,7 @@ vips__gslist_gvalue_merge(GSList *a, const GSList *b)
992
988
for (j = a ; j ; j = j -> next ) {
993
989
GValue * value2 = (GValue * ) j -> data ;
994
990
995
- g_assert (G_VALUE_TYPE (value2 ) ==
996
- VIPS_TYPE_REF_STRING );
991
+ g_assert (G_VALUE_TYPE (value2 ) == VIPS_TYPE_REF_STRING );
997
992
998
993
/* Just do a pointer compare ... good enough 99.9% of
999
994
* the time.
@@ -1004,8 +999,7 @@ vips__gslist_gvalue_merge(GSList *a, const GSList *b)
1004
999
}
1005
1000
1006
1001
if (!j )
1007
- tail = g_slist_prepend (tail ,
1008
- vips__gvalue_copy (value ));
1002
+ tail = g_slist_prepend (tail , vips__gvalue_copy (value ));
1009
1003
}
1010
1004
1011
1005
a = g_slist_concat (a , g_slist_reverse (tail ));
@@ -1101,8 +1095,7 @@ vips__seek(int fd, gint64 pos, int whence)
1101
1095
gint64 new_pos ;
1102
1096
1103
1097
if ((new_pos = vips__seek_no_error (fd , pos , whence )) == -1 ) {
1104
- vips_error_system (errno , "vips__seek" ,
1105
- "%s" , _ ("unable to seek" ));
1098
+ vips_error_system (errno , "vips__seek" , "%s" , _ ("unable to seek" ));
1106
1099
return -1 ;
1107
1100
}
1108
1101
@@ -1365,8 +1358,7 @@ vips__token_must(const char *p, VipsToken *token,
1365
1358
char * string , int size )
1366
1359
{
1367
1360
if (!(p = vips__token_get (p , token , string , size ))) {
1368
- vips_error ("get_token" ,
1369
- "%s" , _ ("unexpected end of string" ));
1361
+ vips_error ("get_token" , "%s" , _ ("unexpected end of string" ));
1370
1362
return NULL ;
1371
1363
}
1372
1364
@@ -1633,8 +1625,7 @@ vips__temp_name(const char *format)
1633
1625
1634
1626
int serial = g_atomic_int_add (& global_serial , 1 );
1635
1627
1636
- g_snprintf (file , FILENAME_MAX , "vips-%d-%u" ,
1637
- serial , g_random_int ());
1628
+ g_snprintf (file , FILENAME_MAX , "vips-%d-%u" , serial , g_random_int ());
1638
1629
g_snprintf (file2 , FILENAME_MAX , format , file );
1639
1630
name = g_build_filename (vips__temp_dir (), file2 , NULL );
1640
1631
@@ -1960,8 +1951,7 @@ vips_icc_dir_once(void *null)
1960
1951
*/
1961
1952
char * windowsdir ;
1962
1953
1963
- if ((windowsdir = g_utf16_to_utf8 (wwindowsdir ,
1964
- -1 , NULL , NULL , NULL ))) {
1954
+ if ((windowsdir = g_utf16_to_utf8 (wwindowsdir , -1 , NULL , NULL , NULL ))) {
1965
1955
gchar * full_path ;
1966
1956
1967
1957
full_path = g_build_filename (windowsdir ,
@@ -1981,8 +1971,7 @@ vips__icc_dir(void)
1981
1971
{
1982
1972
static GOnce once = G_ONCE_INIT ;
1983
1973
1984
- return (const char * ) g_once (& once ,
1985
- vips_icc_dir_once , NULL );
1974
+ return (const char * ) g_once (& once , vips_icc_dir_once , NULL );
1986
1975
}
1987
1976
1988
1977
#ifdef G_OS_WIN32
@@ -2005,8 +1994,7 @@ vips__windows_prefix_once(void *null)
2005
1994
char * prefix ;
2006
1995
2007
1996
#ifdef G_OS_WIN32
2008
- prefix = g_win32_get_package_installation_directory_of_module (
2009
- vips__dll );
1997
+ prefix = g_win32_get_package_installation_directory_of_module (vips__dll );
2010
1998
#else /*!G_OS_WIN32*/
2011
1999
prefix = (char * ) g_getenv ("VIPSHOME" );
2012
2000
#endif /*G_OS_WIN32*/
@@ -2019,8 +2007,7 @@ vips__windows_prefix(void)
2019
2007
{
2020
2008
static GOnce once = G_ONCE_INIT ;
2021
2009
2022
- return (const char * ) g_once (& once ,
2023
- vips__windows_prefix_once , NULL );
2010
+ return (const char * ) g_once (& once , vips__windows_prefix_once , NULL );
2024
2011
}
2025
2012
2026
2013
char *
0 commit comments