[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: C expert wanted
From:       Warren Turkal <wturkal () cbu ! edu>
Date:       2001-10-01 19:17:28
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 01 October 2001 07:27, Oswald Buddenhagen wrote:
> > >  g_chunk_length = mIndexLength;
> > >  g_chunk = (uchar *)realloc(g_chunk,
> > > sizeof(g_chunk)*g_chunk_length);
> > >
> > > The second parm is the size of the allocated space in bytes.
> >
> > Well, but then I get four times as much RAM as I want, assuming
> > that sizeof(g_chunk) == 4.
>
> exactly.
> what he probably had in mind was sizeof(g_chunk[0]) * nIndexLength
> - but that's the same as michael's original code, as sizeof(char) is
> usually 1 ...
>
> greetings

I may have meant:
g_chunk = (uchar*)realloc(g_chunk, sizeof(uchar)*g_chunk_length);
I think that makes more sense. Maybe. I am no C guru.
Warren
- -- 
GPG Fingerprint: 30C8 BDF1 B133 14CB 832F  2C5D 99A1 A19F 559D 9E88
GPG Public Key @ http://www.cbu.edu/~wturkal/wturkal.gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7uMFImaGhn1WdnogRAgJnAJ0eX2UNn255kflbKr7t5vdLwjVGDwCggIKZ
r3xIdwpmjZ+HYFvHbVnHmfs=
=H+8D
-----END PGP SIGNATURE-----
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic