mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
core/back: replace objc_{malloc/free} with malloc/free
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@31629 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c3bf8b14c5
commit
f228d45b78
9 changed files with 60 additions and 48 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-11-18 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/winlib/WIN32FontInfo.m:
|
||||
* Source/winlib/WIN32GState.m:
|
||||
* Source/cairo/CairoFontInfo.m:
|
||||
* Source/cairo/CairoGState.m:
|
||||
* Source/win32/w32_general.m:
|
||||
* Source/win32/w32_create.m:
|
||||
* Source/x11/XGServerWindow.m:
|
||||
* Source/gsc/GSGState.m: Replace objc_malloc with malloc and
|
||||
objc_free with free
|
||||
|
||||
2010-09-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/x11/convert.c (image2StandardPseudoColor): Small change
|
||||
|
|
|
@ -42,18 +42,18 @@
|
|||
_cacheSize = size;
|
||||
if (_cachedSizes)
|
||||
{
|
||||
objc_free(_cachedSizes);
|
||||
free(_cachedSizes);
|
||||
}
|
||||
if (_cachedGlyphs)
|
||||
{
|
||||
objc_free(_cachedGlyphs);
|
||||
free(_cachedGlyphs);
|
||||
}
|
||||
_cachedSizes = objc_malloc(sizeof(NSSize) * size);
|
||||
_cachedSizes = malloc(sizeof(NSSize) * size);
|
||||
if (_cachedSizes)
|
||||
{
|
||||
memset(_cachedSizes, 0, sizeof(NSSize) * size);
|
||||
}
|
||||
_cachedGlyphs = objc_malloc(sizeof(unsigned int) * size);
|
||||
_cachedGlyphs = malloc(sizeof(unsigned int) * size);
|
||||
if (_cachedGlyphs)
|
||||
{
|
||||
memset(_cachedGlyphs, 0, sizeof(unsigned int) * size);
|
||||
|
@ -183,9 +183,9 @@
|
|||
cairo_scaled_font_destroy(_scaled);
|
||||
}
|
||||
if (_cachedSizes)
|
||||
objc_free(_cachedSizes);
|
||||
free(_cachedSizes);
|
||||
if (_cachedGlyphs)
|
||||
objc_free(_cachedGlyphs);
|
||||
free(_cachedGlyphs);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
return;
|
||||
}
|
||||
|
||||
cdata = objc_malloc(sizeof(char) * 4 * ix * iy);
|
||||
cdata = malloc(sizeof(char) * 4 * ix * iy);
|
||||
if (!cdata)
|
||||
{
|
||||
NSLog(@"Could not allocate drawing space for glyphs");
|
||||
|
@ -352,7 +352,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
NSLog(@"Error while creating surface: %s",
|
||||
cairo_status_to_string(status));
|
||||
cairo_surface_destroy(isurface);
|
||||
objc_free(cdata);
|
||||
free(cdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
cairo_status_to_string(cairo_status(ct)));
|
||||
cairo_destroy(ct);
|
||||
cairo_surface_destroy(isurface);
|
||||
objc_free(cdata);
|
||||
free(cdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
cairo_status_to_string(cairo_status(ct)));
|
||||
cairo_destroy(ct);
|
||||
cairo_surface_destroy(isurface);
|
||||
objc_free(cdata);
|
||||
free(cdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
cairo_status_to_string(cairo_status(ct)));
|
||||
cairo_destroy(ct);
|
||||
cairo_surface_destroy(isurface);
|
||||
objc_free(cdata);
|
||||
free(cdata);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
|
|||
}
|
||||
cairo_destroy(ct);
|
||||
cairo_surface_destroy(isurface);
|
||||
objc_free(cdata);
|
||||
free(cdata);
|
||||
}
|
||||
|
||||
- (void) drawGlyphs: (const NSGlyph*)glyphs
|
||||
|
|
|
@ -1100,7 +1100,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
switch (bitsPerPixel)
|
||||
{
|
||||
case 32:
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
tmp = malloc(pixels * 4);
|
||||
if (!tmp)
|
||||
{
|
||||
NSLog(@"Could not allocate drawing space for image");
|
||||
|
@ -1134,7 +1134,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
format = CAIRO_FORMAT_ARGB32;
|
||||
break;
|
||||
case 24:
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
tmp = malloc(pixels * 4);
|
||||
if (!tmp)
|
||||
{
|
||||
NSLog(@"Could not allocate drawing space for image");
|
||||
|
@ -1183,7 +1183,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
NSLog(@"Cairo status '%s' in DPSimage", cairo_status_to_string(status));
|
||||
if (tmp)
|
||||
{
|
||||
objc_free(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1233,7 +1233,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
|
||||
if (tmp)
|
||||
{
|
||||
objc_free(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1172,7 +1172,7 @@ typedef enum {
|
|||
rect = [function affectedRect];
|
||||
iwidth = rect.size.width;
|
||||
iheight = rect.size.height;
|
||||
data = objc_malloc(sizeof(char) * iwidth * iheight * 4);
|
||||
data = malloc(sizeof(char) * iwidth * iheight * 4);
|
||||
i = 0;
|
||||
|
||||
for (y = NSMinY(rect); y < NSMaxY(rect); y++)
|
||||
|
@ -1218,7 +1218,7 @@ typedef enum {
|
|||
: 32 : 4 * iwidth : NO
|
||||
: YES : NSDeviceRGBColorSpace
|
||||
: (const unsigned char **)&data];
|
||||
objc_free(data);
|
||||
free(data);
|
||||
|
||||
DESTROY(matrix);
|
||||
DESTROY(inverse);
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
/* For windows with backingstore we create a compatible DC, that
|
||||
is stored in the extra fields for this window. Drawing operations
|
||||
work on this buffer. */
|
||||
win = objc_malloc(sizeof(WIN_INTERN));
|
||||
win = malloc(sizeof(WIN_INTERN));
|
||||
SetWindowLong(hwnd, GWL_USERDATA, (int)win);
|
||||
|
||||
if (type != NSBackingStoreNonretained)
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
DeleteObject(old);
|
||||
DeleteDC(win->hdc);
|
||||
}
|
||||
objc_free(win);
|
||||
free(win);
|
||||
flags._eventHandled=YES;
|
||||
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ NSLog(@"No glyph for U%d", c);
|
|||
count = (unsigned)GetFontUnicodeRanges(hdc, 0);
|
||||
if (count > 0)
|
||||
{
|
||||
gs = (GLYPHSET*)objc_malloc(count);
|
||||
gs = (GLYPHSET*)malloc(count);
|
||||
if (!gs)
|
||||
{
|
||||
SelectObject(hdc, old);
|
||||
|
@ -246,7 +246,7 @@ NSLog(@"No glyph for U%d", c);
|
|||
}
|
||||
}
|
||||
}
|
||||
objc_free(gs);
|
||||
free(gs);
|
||||
}
|
||||
SelectObject(hdc, old);
|
||||
DeleteDC(hdc);
|
||||
|
@ -375,16 +375,16 @@ NSLog(@"No glyph for U%d", c);
|
|||
return;
|
||||
}
|
||||
|
||||
ptPoints = objc_malloc(sizeof(POINT) * iPoints);
|
||||
ptPoints = malloc(sizeof(POINT) * iPoints);
|
||||
if (!ptPoints)
|
||||
{
|
||||
DeleteDC(hDC);
|
||||
return;
|
||||
}
|
||||
bTypes = objc_malloc(sizeof(BYTE) * iPoints);
|
||||
bTypes = malloc(sizeof(BYTE) * iPoints);
|
||||
if (!bTypes)
|
||||
{
|
||||
objc_free(ptPoints);
|
||||
free(ptPoints);
|
||||
DeleteDC(hDC);
|
||||
return;
|
||||
}
|
||||
|
@ -419,8 +419,8 @@ NSLog(@"No glyph for U%d", c);
|
|||
}
|
||||
}
|
||||
|
||||
objc_free(bTypes);
|
||||
objc_free(ptPoints);
|
||||
free(bTypes);
|
||||
free(ptPoints);
|
||||
DeleteDC(hDC);
|
||||
}
|
||||
|
||||
|
|
|
@ -616,11 +616,11 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
|
||||
if (bitsPerPixel > 8)
|
||||
{
|
||||
bitmap = objc_malloc(sizeof(BITMAPV4HEADER));
|
||||
bitmap = malloc(sizeof(BITMAPV4HEADER));
|
||||
}
|
||||
else
|
||||
{
|
||||
bitmap = objc_malloc(sizeof(BITMAPINFOHEADER) +
|
||||
bitmap = malloc(sizeof(BITMAPINFOHEADER) +
|
||||
(1 << bitsPerPixel) * sizeof(RGBQUAD));
|
||||
}
|
||||
bmih = (BITMAPINFOHEADER*)bitmap;
|
||||
|
@ -659,7 +659,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
NSDebugLLog(@"WIN32GState", @"8bit greyscale picture with pixelsWide:%d "
|
||||
@"pixelsHigh:%d", pixelsWide, pixelsHigh);
|
||||
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
tmp = malloc(pixels * 4);
|
||||
|
||||
if ([colorSpaceName isEqualToString: NSCalibratedWhiteColorSpace])
|
||||
{
|
||||
|
@ -707,7 +707,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
bmih->bV4GreenMask = 0x0000FF00;
|
||||
bmih->bV4RedMask = 0x00FF0000;
|
||||
bmih->bV4AlphaMask = 0xFF000000;
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
tmp = malloc(pixels * 4);
|
||||
while (i < pixels*4)
|
||||
{
|
||||
tmp[i+0] = bits[i+2];
|
||||
|
@ -729,7 +729,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
NSDebugLLog(@"WIN32GState", @"24bit picure with pixelsWide:%d "
|
||||
@"pixelsHigh:%d", pixelsWide, pixelsHigh);
|
||||
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
tmp = malloc(pixels * 4);
|
||||
//memset(tmp, 0xFF, pixels*4);
|
||||
while (i < (pixels*4))
|
||||
{
|
||||
|
@ -770,9 +770,9 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
if (bits != data[0])
|
||||
{
|
||||
/* cast bits to Void Pointer to fix warning in compile */
|
||||
objc_free((void *)(bits));
|
||||
free((void *)(bits));
|
||||
}
|
||||
objc_free(bitmap);
|
||||
free(bitmap);
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
|
@ -1252,14 +1252,14 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
// The user has defined a dash pattern for stroking on
|
||||
// the path. Note that we lose the floating point information
|
||||
// here, as windows only supports DWORD elements, not float.
|
||||
thePattern = objc_malloc(sizeof(float) * patternCount);
|
||||
thePattern = malloc(sizeof(float) * patternCount);
|
||||
[path getLineDash: thePattern count: &patternCount phase: &phase];
|
||||
|
||||
iPattern = objc_malloc(sizeof(DWORD) * patternCount);
|
||||
iPattern = malloc(sizeof(DWORD) * patternCount);
|
||||
int i = 0;
|
||||
for (i = 0 ; i < patternCount; i ++)
|
||||
iPattern[i] = (DWORD)thePattern[i];
|
||||
objc_free(thePattern);
|
||||
free(thePattern);
|
||||
thePattern = NULL;
|
||||
}
|
||||
else
|
||||
|
@ -1274,7 +1274,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
|
||||
if (iPattern)
|
||||
{
|
||||
objc_free(iPattern);
|
||||
free(iPattern);
|
||||
iPattern = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -703,7 +703,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
root = [self _rootWindowForScreen: defScreen];
|
||||
context = [self xrContextForScreen: defScreen];
|
||||
|
||||
window = objc_malloc(sizeof(gswindow_device_t));
|
||||
window = malloc(sizeof(gswindow_device_t));
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = defScreen;
|
||||
|
@ -1256,7 +1256,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
if (window)
|
||||
return window;
|
||||
|
||||
window = objc_malloc(sizeof(gswindow_device_t));
|
||||
window = malloc(sizeof(gswindow_device_t));
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
|
||||
window->display = dpy;
|
||||
|
@ -1509,7 +1509,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
{
|
||||
const char *str = [[pInfo processName] UTF8String];
|
||||
|
||||
rootName = objc_malloc(strlen(str) + 1);
|
||||
rootName = malloc(strlen(str) + 1);
|
||||
strcpy(rootName, str);
|
||||
}
|
||||
classhint.res_name = rootName;
|
||||
|
@ -1536,13 +1536,13 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
args = [pInfo arguments];
|
||||
}
|
||||
argc = [args count];
|
||||
argv = (char**)objc_malloc(argc*sizeof(char*));
|
||||
argv = (char**)malloc(argc*sizeof(char*));
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
argv[i] = (char*)[[args objectAtIndex: i] UTF8String];
|
||||
}
|
||||
XSetCommand(dpy, ROOT, argv, argc);
|
||||
objc_free(argv);
|
||||
free(argv);
|
||||
|
||||
// Store the host name of the machine we a running on
|
||||
XStringListToTextProperty((char**)&host_name, 1, &windowName);
|
||||
|
@ -1772,7 +1772,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
data = [rep bitmapData];
|
||||
|
||||
iconSize = 2 + w * h;
|
||||
iconPropertyData = (long *)objc_malloc(sizeof(long) * iconSize);
|
||||
iconPropertyData = (long *)malloc(sizeof(long) * iconSize);
|
||||
if (iconPropertyData == NULL)
|
||||
{
|
||||
NSLog(@"No memory for WM icon");
|
||||
|
@ -1853,7 +1853,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
{
|
||||
if (iconPropertyData != NULL)
|
||||
{
|
||||
objc_free(iconPropertyData);
|
||||
free(iconPropertyData);
|
||||
}
|
||||
|
||||
image = [NSApp applicationIconImage];
|
||||
|
@ -1891,7 +1891,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
|
||||
/* Create the window structure and set the style early so we can use it to
|
||||
convert frames. */
|
||||
window = objc_malloc(sizeof(gswindow_device_t));
|
||||
window = malloc(sizeof(gswindow_device_t));
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = screen;
|
||||
|
@ -2089,7 +2089,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
|
||||
/* Create the window structure and set the style early so we can use it to
|
||||
convert frames. */
|
||||
window = objc_malloc(sizeof(gswindow_device_t));
|
||||
window = malloc(sizeof(gswindow_device_t));
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = *screen;
|
||||
|
@ -2219,7 +2219,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
XDestroyRegion (window->region);
|
||||
RELEASE(window->exposedRects);
|
||||
NSMapRemove(windowtags, (void*)(uintptr_t)win);
|
||||
objc_free(window);
|
||||
free(window);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue