[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] [patch] malloc -> g_malloc, free -> g_free
From: |
Thomas Fitzsimmons |
Subject: |
[cp-patches] [patch] malloc -> g_malloc, free -> g_free |
Date: |
Mon, 11 Jul 2005 19:56:36 -0400 |
Hi,
We should use the g_ variants of malloc and free in the GTK peers. I
committed this patch.
Tom
2005-07-11 Thomas Fitzsimmons <address@hidden>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
Replace occurrences of malloc with g_malloc and free with g_free.
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.29
diff -u -u -r1.29 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c 11 Jul 2005
23:27:43 -0000 1.29
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c 11 Jul 2005
23:53:21 -0000
@@ -391,7 +391,7 @@
g->jarray = (*env)->NewGlobalRef (env, g_old->jarray);
g->javabuf = (*env)->GetIntArrayElements (env, g->jarray, &g->isCopy);
g->isCopy = JNI_TRUE;
- g->javabuf_copy = (jint *) malloc (size);
+ g->javabuf_copy = (jint *) g_malloc (size);
memcpy (g->javabuf_copy, g->javabuf, size);
g->surface = cairo_image_surface_create_for_data ((unsigned char *)
g->javabuf,
CAIRO_FORMAT_ARGB32,
@@ -450,7 +450,7 @@
/* We didn't get direct access to the pixel buffer, so we'll have to
maintain a separate copy for Cairo. */
jint size = gr->width * gr->height * 4;
- gr->javabuf_copy = (jint *) malloc (size);
+ gr->javabuf_copy = (jint *) g_malloc (size);
memcpy (gr->javabuf_copy, gr->javabuf, size);
cairobuf = gr->javabuf_copy;
}
@@ -677,7 +677,7 @@
{
(*env)->DeleteGlobalRef (env, gr->jarray);
if (gr->javabuf_copy)
- free (gr->javabuf_copy);
+ g_free (gr->javabuf_copy);
}
if (gr->debug) printf ("disposed of graphics2d\n");
@@ -804,7 +804,7 @@
cairo_surface_destroy (gr->pattern_surface);
if (gr->pattern_pixels)
- free (gr->pattern_pixels);
+ g_free (gr->pattern_pixels);
gr->pattern_pixels = NULL;
gr->pattern_surface = surf;
@@ -843,13 +843,13 @@
cairo_surface_destroy (gr->pattern_surface);
if (gr->pattern_pixels)
- free (gr->pattern_pixels);
+ g_free (gr->pattern_pixels);
gr->pattern = NULL;
gr->pattern_surface = NULL;
gr->pattern_pixels = NULL;
- gr->pattern_pixels = (char *) malloc (h * stride * 4);
+ gr->pattern_pixels = (char *) g_malloc (h * stride * 4);
g_assert (gr->pattern_pixels != NULL);
jpixels = (*env)->GetIntArrayElements (env, jarr, NULL);
@@ -1183,7 +1183,7 @@
install_font_peer(gr->cr, pfont, gr->debug);
- glyphs = malloc( sizeof(cairo_glyph_t) * n);
+ glyphs = g_malloc( sizeof(cairo_glyph_t) * n);
g_assert (glyphs != NULL);
native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
- [cp-patches] [patch] malloc -> g_malloc, free -> g_free,
Thomas Fitzsimmons <=