git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32410 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-28 14:24:57 +00:00
parent c028d0568d
commit 89b2b64d5e
4 changed files with 35 additions and 35 deletions

View file

@ -63,7 +63,7 @@
_selectorsCount = [sels count]; _selectorsCount = [sels count];
_selectors = objc_malloc (sizeof (SEL) * _selectorsCount); _selectors = malloc (sizeof (SEL) * _selectorsCount);
for (i = 0; i < _selectorsCount; i++) for (i = 0; i < _selectorsCount; i++)
{ {
@ -84,7 +84,7 @@
- (void) dealloc - (void) dealloc
{ {
objc_free (_selectors); free (_selectors);
[super dealloc]; [super dealloc];
} }

View file

@ -213,7 +213,7 @@
else else
{ {
_bindingsCount++; _bindingsCount++;
_bindings = objc_realloc (_bindings, sizeof (struct _GSKeyBinding) _bindings = realloc (_bindings, sizeof (struct _GSKeyBinding)
* _bindingsCount); * _bindingsCount);
} }
_bindings[_bindingsCount - 1].character = character; _bindings[_bindingsCount - 1].character = character;
@ -266,7 +266,7 @@
RELEASE (_bindings[i].action); RELEASE (_bindings[i].action);
RELEASE (_bindings[i].table); RELEASE (_bindings[i].table);
} }
objc_free (_bindings); free (_bindings);
[super dealloc]; [super dealloc];
} }

View file

@ -94,7 +94,7 @@ static void run_remove(glyph_run_head_t **context, glyph_run_t *r)
// Free the glyphs // Free the glyphs
if (r->glyphs) if (r->glyphs)
objc_free(r->glyphs); free(r->glyphs);
h = &r->head; h = &r->head;
if (h->next) if (h->next)
@ -104,7 +104,7 @@ static void run_remove(glyph_run_head_t **context, glyph_run_t *r)
context[i]->next = context[i]->next->next; context[i]->next = context[i]->next->next;
h -= r->level; h -= r->level;
objc_free(h); free(h);
} }
/* /*
@ -116,7 +116,7 @@ static inline void run_free_glyphs(glyph_run_t *r)
{ {
r->head.complete = 0; r->head.complete = 0;
r->head.glyph_length = 0; r->head.glyph_length = 0;
objc_free(r->glyphs); free(r->glyphs);
r->glyphs = NULL; r->glyphs = NULL;
} }
} }
@ -230,16 +230,16 @@ Private method used internally by GSLayoutManager for sanity checking.
{ {
next = (glyph_run_t *)cur->head.next; next = (glyph_run_t *)cur->head.next;
if (cur->glyphs) if (cur->glyphs)
objc_free(cur->glyphs); free(cur->glyphs);
[self _run_free_attributes: cur]; [self _run_free_attributes: cur];
// Find the start of the allocated memory // Find the start of the allocated memory
h = &cur->head; h = &cur->head;
h -= cur->level; h -= cur->level;
objc_free(h); free(h);
} }
// Free the head element // Free the head element
objc_free(glyphs); free(glyphs);
glyphs = NULL; glyphs = NULL;
} }
@ -1795,12 +1795,12 @@ places where we switch.
for (j = 0, lf = tc->linefrags; j < tc->num_linefrags + tc->num_soft; j++, lf++) for (j = 0, lf = tc->linefrags; j < tc->num_linefrags + tc->num_soft; j++, lf++)
{ {
if (lf->points) if (lf->points)
objc_free(lf->points); free(lf->points);
if (lf->attachments) if (lf->attachments)
objc_free(lf->attachments); free(lf->attachments);
} }
objc_free(tc->linefrags); free(tc->linefrags);
} }
tc->linefrags = NULL; tc->linefrags = NULL;
tc->num_linefrags = tc->num_soft = 0; tc->num_linefrags = tc->num_soft = 0;
@ -1887,12 +1887,12 @@ places where we switch.
{ {
if (lf->points) if (lf->points)
{ {
objc_free(lf->points); free(lf->points);
lf->points = NULL; lf->points = NULL;
} }
if (lf->attachments) if (lf->attachments)
{ {
objc_free(lf->attachments); free(lf->attachments);
lf->attachments = NULL; lf->attachments = NULL;
} }
} }
@ -1967,12 +1967,12 @@ places where we switch.
{ {
if (lf->points) if (lf->points)
{ {
objc_free(lf->points); free(lf->points);
lf->points = NULL; lf->points = NULL;
} }
if (lf->attachments) if (lf->attachments)
{ {
objc_free(lf->attachments); free(lf->attachments);
lf->attachments = NULL; lf->attachments = NULL;
} }
} }
@ -2195,7 +2195,7 @@ by calling this incorrectly.
if (tc->size_linefrags <= tc->num_linefrags) if (tc->size_linefrags <= tc->num_linefrags)
{ {
tc->size_linefrags += tc->size_linefrags / 2; tc->size_linefrags += tc->size_linefrags / 2;
tc->linefrags = objc_realloc(tc->linefrags, sizeof(linefrag_t) * tc->size_linefrags); tc->linefrags = realloc(tc->linefrags, sizeof(linefrag_t) * tc->size_linefrags);
} }
tc->num_linefrags++; tc->num_linefrags++;
lf = &tc->linefrags[tc->num_linefrags - 1]; lf = &tc->linefrags[tc->num_linefrags - 1];
@ -2209,12 +2209,12 @@ by calling this incorrectly.
break; break;
if (lf->points) if (lf->points)
{ {
objc_free(lf->points); free(lf->points);
lf->points = NULL; lf->points = NULL;
} }
if (lf->attachments) if (lf->attachments)
{ {
objc_free(lf->attachments); free(lf->attachments);
lf->attachments = NULL; lf->attachments = NULL;
} }
} }
@ -2228,7 +2228,7 @@ by calling this incorrectly.
if (tc->size_linefrags <= tc->num_linefrags + tc->num_soft) if (tc->size_linefrags <= tc->num_linefrags + tc->num_soft)
{ {
tc->size_linefrags += tc->size_linefrags / 2; tc->size_linefrags += tc->size_linefrags / 2;
tc->linefrags = objc_realloc(tc->linefrags, sizeof(linefrag_t) * tc->size_linefrags); tc->linefrags = realloc(tc->linefrags, sizeof(linefrag_t) * tc->size_linefrags);
} }
memmove(&tc->linefrags[tc->num_linefrags + 1], &tc->linefrags[tc->num_linefrags], tc->num_soft * sizeof(linefrag_t)); memmove(&tc->linefrags[tc->num_linefrags + 1], &tc->linefrags[tc->num_linefrags], tc->num_soft * sizeof(linefrag_t));
} }
@ -2318,7 +2318,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
return; return;
} }
lf->num_points++; lf->num_points++;
lf->points = objc_realloc(lf->points, sizeof(linefrag_point_t) * lf->num_points); lf->points = realloc(lf->points, sizeof(linefrag_point_t) * lf->num_points);
lp = &lf->points[lf->num_points - 1]; lp = &lf->points[lf->num_points - 1];
} }
lp->pos = glyphRange.location; lp->pos = glyphRange.location;
@ -2367,7 +2367,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
/* TODO: we do no sanity checking of attachment size ranges. might want /* TODO: we do no sanity checking of attachment size ranges. might want
to consider doing it */ to consider doing it */
lf->attachments = objc_realloc(lf->attachments, lf->attachments = realloc(lf->attachments,
sizeof(linefrag_attachment_t) * (lf->num_attachments + 1)); sizeof(linefrag_attachment_t) * (lf->num_attachments + 1));
la = &lf->attachments[lf->num_attachments++]; la = &lf->attachments[lf->num_attachments++];
@ -2651,7 +2651,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
[self _invalidateLayoutFromContainer: index]; [self _invalidateLayoutFromContainer: index];
num_textcontainers++; num_textcontainers++;
textcontainers = objc_realloc(textcontainers, textcontainers = realloc(textcontainers,
sizeof(textcontainer_t) * num_textcontainers); sizeof(textcontainer_t) * num_textcontainers);
for (i = num_textcontainers - 1; i > index; i--) for (i = num_textcontainers - 1; i > index; i--)
@ -2679,11 +2679,11 @@ forStartOfGlyphRange: (NSRange)glyphRange
textcontainers[i] = textcontainers[i + 1]; textcontainers[i] = textcontainers[i + 1];
if (num_textcontainers) if (num_textcontainers)
textcontainers = objc_realloc(textcontainers, textcontainers = realloc(textcontainers,
sizeof(textcontainer_t) * num_textcontainers); sizeof(textcontainer_t) * num_textcontainers);
else else
{ {
objc_free(textcontainers); free(textcontainers);
textcontainers = NULL; textcontainers = NULL;
} }
@ -2876,7 +2876,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
int i; int i;
textcontainer_t *tc; textcontainer_t *tc;
objc_free(rect_array); free(rect_array);
rect_array_size = 0; rect_array_size = 0;
rect_array = NULL; rect_array = NULL;
@ -2885,7 +2885,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
{ {
[tc->textContainer release]; [tc->textContainer release];
} }
objc_free(textcontainers); free(textcontainers);
textcontainers = NULL; textcontainers = NULL;
[self _freeGlyphs]; [self _freeGlyphs];
@ -3160,7 +3160,7 @@ forStartingGlyphAtIndex: (NSUInteger)glyph
} }
else if (run->head.glyph_length < len) else if (run->head.glyph_length < len)
{ {
run->glyphs = objc_realloc(run->glyphs, sizeof(glyph_t) * len); run->glyphs = realloc(run->glyphs, sizeof(glyph_t) * len);
memset(&run->glyphs[glyph - gpos], 0, sizeof(glyph_t) * length); memset(&run->glyphs[glyph - gpos], 0, sizeof(glyph_t) * length);
} }
run->head.glyph_length = len; run->head.glyph_length = len;

View file

@ -225,7 +225,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
// FIXME: Convert all colours to colour space // FIXME: Convert all colours to colour space
ASSIGN(_colors, colorArray); ASSIGN(_colors, colorArray);
_locations = objc_malloc(sizeof(CGFloat)*_numberOfColorStops); _locations = malloc(sizeof(CGFloat)*_numberOfColorStops);
if (locations) if (locations)
{ {
// FIXME: Check that the locations are properly ordered // FIXME: Check that the locations are properly ordered
@ -248,7 +248,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
va_list ap; va_list ap;
unsigned int max = 128; unsigned int max = 128;
unsigned int count = 0; unsigned int count = 0;
CGFloat *locations = (CGFloat*)objc_malloc(max * sizeof(CGFloat)); CGFloat *locations = (CGFloat*)malloc(max * sizeof(CGFloat));
NSMutableArray *colorArray = [[NSMutableArray alloc] init]; NSMutableArray *colorArray = [[NSMutableArray alloc] init];
va_start(ap, color); va_start(ap, color);
@ -257,7 +257,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
if (max <= count) if (max <= count)
{ {
max *= 2; max *= 2;
locations = (CGFloat*)objc_realloc(locations, max * sizeof(CGFloat)); locations = (CGFloat*)realloc(locations, max * sizeof(CGFloat));
} }
[colorArray addObject: color]; [colorArray addObject: color];
// gcc insists on using double here // gcc insists on using double here
@ -272,7 +272,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
colorSpace: nil]; colorSpace: nil];
RELEASE(colorArray); RELEASE(colorArray);
objc_free(locations); free(locations);
return self; return self;
} }
@ -285,7 +285,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
{ {
RELEASE(_colorSpace); RELEASE(_colorSpace);
RELEASE(_colors); RELEASE(_colors);
objc_free(_locations); free(_locations);
[super dealloc]; [super dealloc];
} }
@ -334,7 +334,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
RETAIN(g->_colorSpace); RETAIN(g->_colorSpace);
RETAIN(g->_colors); RETAIN(g->_colors);
g->_locations = objc_malloc(sizeof(CGFloat) * _numberOfColorStops); g->_locations = malloc(sizeof(CGFloat) * _numberOfColorStops);
memcpy(g->_locations, _locations, sizeof(CGFloat) * _numberOfColorStops); memcpy(g->_locations, _locations, sizeof(CGFloat) * _numberOfColorStops);
return g; return g;