TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Kieran Haughey
date: 1995-12-24 10:58:40
subject: Realloc()

On 22 Dec 95 07:40, Paul Edwards wrote to Kieran Haughey:

Hi Paul,

PE>> Post a small program that demonstrates the bug.  For examples of

KH>>     arr_size_cur = 100;

KH>>     while(whatever)
KH>>     {
KH>>         /* any code whatever */
KH>>         if(count >= arr_size_cur && (count+10)>         {
KH>>             buffer = realloc(10,sizeof(char));
KH>>             arr_size_cur+=10;
KH>>         }

PE> Change this to 
PE> {
PE>     arr_size_cur += 10;
PE>     buffer = realloc(buffer, arr_size_cur)
PE> }

I was using arr_size_cur as a counter to make sure I don't run over the
array size... although I was thinking a few days ago that I shouldn't be
using 10 to raise it, but 110 .. 

Will have another fiddle..

But isn't realloc mean't to be realloc(how_many, size_of_each_member)??...

KH>> I would send you the source I have done so far of my program, but there's 
KH>> to much to it.. .. 

PE> Never send the complete program.  A 10 line program should always
PE> be sufficient.  Saves us time (which gives you a higher % chance
PE> of getting a response).  BFN.  Paul.

I know I know.. :).. I just felt like mentioning that before anyone says
"Oh yeah, send me the source and I'll have a look".. 
ÿ
Merry Christmas,
Kieran

3:711/413.17{at}fidonet
@EOT:

--- MsgedSQ 3.30
* Origin: -=> The Last Stand Against Sanity <=- (3:711/413.17)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 420 423 430 510 808 809
SEEN-BY: 711/932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 711/413 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.