delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/26/18:05:33

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro392 NOT HAPPY!
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <e49fls40hq4l5td0nu5tqhcu679vg87pot@4ax.com>
References: <m0melsoth85c48qbomarbt377h7if1pin4 AT 4ax DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 69
X-Trace: +LPib4/PneJxKPAenhstD1c2CSb36Dc+MmpjpjUfy0GzYwvpHC9TjGptkhl0vqJ3bEaLNIJPfecm!RhpYX0Tglz5dFSLSoUpJA2oEHbm5Crf39HaFpzmQO7H8jCVoayoFqoeW9ix42nxO1KnzKYHVa3eF!sy5g
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Mon, 26 Jun 2000 18:58:36 GMT
Distribution: world
Date: Mon, 26 Jun 2000 18:58:36 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Mon, 26 Jun 2000 09:26:09 -0400, Radical NetSurfer
<radsmail AT juno DOT com> wrote:

>I finally decided to download a try out the new W.I.P....
>
>NOW:
> compiling my project in 3.1.2. -->  383,488 bytes
>                                     3.9.2.  --> 610,816
>                       DIFFERENCE:      227,328
>
>WHY?  is this?  I have not had the time to read through
>all of the new 3.9.2. features and options.....

Allegro 3.9.x is designed for portability while retaining speed.
To shrink executables, strip and compress them with UPX.
  http://upx.tsx.org/

>Problem 1:
>In 3.1.2: I wish to learn if and when a bitmap pointer has actually
>been assigned.....
>I have something like:
>BITMAP *a_bmp=NULL;
>
>a_bmp = create_bmp(z, q);
>
>NOW: what is the proper way to determine if 'a_bmp' is still
>un-assigned (NULL) or actually in use, SUCH THAT a
>proper call to 'destroy_bmp()' works....
>Apparently, calling   destroy_bmp()  crashes if the pointer is
>actually unassigned....

It crashes because the pointer points to garbage.  Whenever you free
memory, it's safest to zero the pointer immediately afterwords..

BITMAP *foo;

foo = create_bitmap(w, h);
/* ... */
destroy_bitmap(foo);
foo = NULL;

free()-type functions typically do nothing if passed a null pointer.
I just read through .../allegro/src/graphics.c, and it works the same
way.

>Problem 2:
>
>In 3.1.2: I wish to be able to call a single function, which will
>   either load in an image to a bitmap,
>    or 
>   simply just create an empty bitmap,
>   and return.....
>
>   I want to call this function several times, and EACH time
>REPLACING the contents of the Bitmap, with the NEW
>image (raster)....
>   Can someone PLEASE offer some suggestions how this
>   might be accomplished?

Whenever you want to load in a new bitmap, simply call
destroy_bitmap(bmp) first.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019