Commit e225cfaa authored by Sven Neumann's avatar Sven Neumann
Browse files

fixed bugs #7144 and #7139


--Sven
parent 797979f1
Fri Mar 10 12:29:57 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/sel2path/*.c: do not include malloc.h but use the
glib memory functions instead (should fix bug #7144)
Fri Mar 10 02:55:12 CET 2000 Sven Neumann <sven@gimp.org>
 
* app/blend.c: renamed Blend Mode from "Custom from Editor" to
......
Fri Mar 10 11:36:45 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am: fixed bug #7139
2000-03-06 Michael Natterer <mitch@gimp.org>
* libgimp-decl.txt
......
......@@ -80,7 +80,7 @@ dist-hook:
mkdir $(distdir)/html
mkdir $(distdir)/sgml
mkdir $(distdir)/tmpl
-cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
-cp $(srcdir)/html/*.html $(srcdir)/html/index.sgml $(distdir)/html
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
-cp $(srcdir)/sgml/*.bottom $(srcdir)/sgml/*.top $(distdir)/sgml
......
......@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <malloc.h>
#include <glib.h>
#include "config.h"
#include "global.h"
......@@ -29,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
curve_type
new_curve ()
{
curve_type curve = malloc (sizeof (struct curve));
curve_type curve = g_new (struct curve, 1);
curve->point_list = NULL;
CURVE_LENGTH (curve) = 0;
......@@ -48,7 +48,7 @@ init_curve (coordinate_type coord)
{
curve_type curve = new_curve ();
curve->point_list = malloc (sizeof (point_type));
curve->point_list = g_new (point_type, 1);
CURVE_LENGTH (curve) = 1;
CURVE_POINT (curve, 0) = int_to_real_coord (coord);
......@@ -95,7 +95,7 @@ void
append_point (curve_type curve, real_coordinate_type coord)
{
CURVE_LENGTH (curve)++;
curve->point_list = realloc(curve->point_list,CURVE_LENGTH (curve) * sizeof(point_type));
curve->point_list = g_realloc (curve->point_list,CURVE_LENGTH (curve) * sizeof(point_type));
LAST_CURVE_POINT (curve) = coord;
/* The t value does not need to be set. */
}
......@@ -136,7 +136,7 @@ void
append_curve (curve_list_type *curve_list, curve_type curve)
{
curve_list->length++;
curve_list->data = realloc(curve_list->data,curve_list->length*sizeof(curve_type));
curve_list->data = g_realloc (curve_list->data,curve_list->length*sizeof(curve_type));
curve_list->data[curve_list->length - 1] = curve;
}
......@@ -178,6 +178,6 @@ void
append_curve_list (curve_list_array_type *l, curve_list_type curve_list)
{
CURVE_LIST_ARRAY_LENGTH (*l)++;
l->data = realloc(l->data,( CURVE_LIST_ARRAY_LENGTH (*l))*sizeof(curve_list_type));
l->data = g_realloc (l->data,( CURVE_LIST_ARRAY_LENGTH (*l))*sizeof(curve_list_type));
LAST_CURVE_LIST_ARRAY_ELT (*l) = curve_list;
}
......@@ -21,7 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <float.h>
#include <math.h>
#include <assert.h>
#include <malloc.h>
#include <glib.h>
#include "global.h"
#include "spline.h"
......@@ -1308,7 +1309,7 @@ fit_one_spline (curve_type curve)
int Alen = CURVE_LENGTH (curve);
vector_type *A;
A = (vector_type *)calloc(sizeof(vector_type)*2,Alen);
A = g_new0 (vector_type, Alen * 2);
START_POINT (spline) = CURVE_POINT (curve, 0);
END_POINT (spline) = LAST_CURVE_POINT (curve);
......@@ -1361,7 +1362,7 @@ fit_one_spline (curve_type curve)
Vmult_scalar (t2_hat, alpha2));
SPLINE_DEGREE (spline) = CUBIC;
free(A);
g_free (A);
return spline;
}
......@@ -1617,7 +1618,7 @@ find_tangent (curve_type curve, boolean to_start_point, boolean cross_curve)
if (*curve_tangent == NULL)
{
*curve_tangent = malloc (sizeof (vector_type));
*curve_tangent = g_new (vector_type, 1);
tangent = find_half_tangent (curve, to_start_point, &n_points);
if (cross_curve)
......@@ -1933,7 +1934,7 @@ free_index_list (index_list_type *index_list)
{
if (INDEX_LIST_LENGTH (*index_list) > 0)
{
free (index_list->data);
g_free (index_list->data);
index_list->data = NULL;
INDEX_LIST_LENGTH (*index_list) = 0;
}
......@@ -1944,7 +1945,7 @@ static void
append_index (index_list_type *list, unsigned new_index)
{
INDEX_LIST_LENGTH (*list)++;
list->data = (unsigned *)realloc(list->data,(INDEX_LIST_LENGTH (*list)) * sizeof(unsigned));
list->data = (unsigned *)g_realloc(list->data,(INDEX_LIST_LENGTH (*list)) * sizeof(unsigned));
/* XRETALLOC (list->data, INDEX_LIST_LENGTH (*list), unsigned); */
list->data[INDEX_LIST_LENGTH (*list) - 1] = new_index;
}
......
......@@ -167,7 +167,7 @@ map_to_unit (real *values, unsigned value_count)
{
real smallest, largest;
int this_value;
real *mapped_values = malloc (sizeof (real) * value_count);
real *mapped_values = g_new (real, value_count);
find_bounds (values, value_count, &smallest, &largest);
......
......@@ -45,7 +45,7 @@ local_new_bitmap (unsigned width,unsigned height)
BITMAP_HEIGHT(answer) = height;
BITMAP_WIDTH(answer) = width;
BITMAP_BITS (answer) = size > 0 ? calloc (size, 1) : NULL;
BITMAP_BITS (answer) = g_new0 (one_byte, size); /* g_new returns NULL if size == 0 */
/* printf("local_new_bitmap size = %d @[%p]\n",size,BITMAP_BITS (answer)); */
......@@ -150,7 +150,7 @@ append_pixel_outline (pixel_outline_list_type *outline_list,
pixel_outline_type outline)
{
O_LIST_LENGTH (*outline_list)++;
outline_list->data = (pixel_outline_type *)realloc(outline_list->data,outline_list->length *sizeof(pixel_outline_type));
outline_list->data = (pixel_outline_type *)g_realloc(outline_list->data,outline_list->length *sizeof(pixel_outline_type));
O_LIST_OUTLINE (*outline_list, O_LIST_LENGTH (*outline_list) - 1) = outline;
}
......@@ -194,7 +194,7 @@ static void
append_outline_pixel (pixel_outline_type *o, coordinate_type c)
{
O_LENGTH (*o)++;
o->data = (coordinate_type *)realloc(o->data, O_LENGTH (*o)*sizeof(coordinate_type));
o->data = (coordinate_type *)g_realloc(o->data, O_LENGTH (*o)*sizeof(coordinate_type));
O_COORDINATE (*o, O_LENGTH (*o) - 1) = c;
}
......
......@@ -659,10 +659,9 @@ safe_free (address *item)
if (item == NULL || *item == NULL)
{
g_warning ("safe_free: Attempt to free a null item.");
abort ();
}
free (*item);
g_free (*item);
*item = NULL;
}
......@@ -16,9 +16,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <malloc.h>
#include <assert.h>
#include <glib.h>
#include "global.h"
#include "bounding-box.h"
#include "spline.h"
......@@ -114,7 +115,7 @@ evaluate_spline (spline_type s, real t)
spline_list_type *
new_spline_list ()
{
spline_list_type *answer = malloc (sizeof (spline_list_type));
spline_list_type *answer = g_new (spline_list_type, 1);
SPLINE_LIST_DATA (*answer) = NULL;
SPLINE_LIST_LENGTH (*answer) = 0;
......@@ -128,9 +129,9 @@ new_spline_list ()
spline_list_type *
init_spline_list (spline_type spline)
{
spline_list_type *answer = malloc (sizeof (spline_list_type));
spline_list_type *answer = g_new (spline_list_type, 1);
SPLINE_LIST_DATA (*answer) = malloc (sizeof (spline_type));
SPLINE_LIST_DATA (*answer) = g_new (spline_type, 1);
SPLINE_LIST_ELT (*answer, 0) = spline;
SPLINE_LIST_LENGTH (*answer) = 1;
......@@ -158,7 +159,7 @@ append_spline (spline_list_type *l, spline_type s)
assert (l != NULL);
SPLINE_LIST_LENGTH (*l)++;
SPLINE_LIST_DATA (*l) = realloc (SPLINE_LIST_DATA (*l),
SPLINE_LIST_DATA (*l) = g_realloc (SPLINE_LIST_DATA (*l),
SPLINE_LIST_LENGTH (*l) * sizeof (spline_type));
LAST_SPLINE_LIST_ELT (*l) = s;
}
......@@ -177,7 +178,7 @@ concat_spline_lists (spline_list_type *s1, spline_list_type s2)
new_length = SPLINE_LIST_LENGTH (*s1) + SPLINE_LIST_LENGTH (s2);
SPLINE_LIST_DATA (*s1) = realloc(SPLINE_LIST_DATA (*s1),new_length * sizeof(spline_type));
SPLINE_LIST_DATA (*s1) = g_realloc(SPLINE_LIST_DATA (*s1),new_length * sizeof(spline_type));
for (this_spline = 0; this_spline < SPLINE_LIST_LENGTH (s2); this_spline++)
SPLINE_LIST_ELT (*s1, SPLINE_LIST_LENGTH (*s1)++)
......@@ -224,6 +225,6 @@ append_spline_list (spline_list_array_type *l, spline_list_type s)
{
SPLINE_LIST_ARRAY_LENGTH (*l)++;
SPLINE_LIST_ARRAY_DATA (*l) = realloc(SPLINE_LIST_ARRAY_DATA (*l),(SPLINE_LIST_ARRAY_LENGTH (*l))*sizeof(spline_list_type));
SPLINE_LIST_ARRAY_DATA (*l) = g_realloc(SPLINE_LIST_ARRAY_DATA (*l),(SPLINE_LIST_ARRAY_LENGTH (*l))*sizeof(spline_list_type));
LAST_SPLINE_LIST_ARRAY_ELT (*l) = s;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment