gnutls-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: small point of detail


From: B. Scott Michel
Subject: Re: small point of detail
Date: Fri, 31 Aug 2012 14:41:29 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
_entry is a pointer to a pointer to a SRP_PWD_ENTRY. calloc() and friends return a void pointer, which means that the code has to dereference _entry in order to assign it the value from calloc(). calloc() allocates a 1 element sized array, where each element is the size of a SRP_PWD_ENTRY. And, the resulting memory is filled with zeroes.

The "entry = *_entry" statement just makes entry point to the same thing as *_entry, which is the memory just allocated by calloc().

entry is just used a shorthand for (*_entry) in the subsequent code. Otherwise, you'd have to write (*_entry)-> to manipulate the SRP_PWD_ENTRY structure.

Hope this helps you understand the code better.


- -scooter


On 8/30/2012 3:29 PM, ml wrote:
> this feature is a point of detail to the file
> auth_srp_passwd.c
> line 266
> gnutls 2 last release
>
>
> Le vendredi 31 août 2012 à 00:24 +0200, ml a écrit :
>> hello all gurus
>> I just go a small part of the code and I wonder one thing that is a
>> small point of detail
>>
>> *_entry = gnutls_calloc (1, sizeof (SRP_PWD_ENTRY));
>> if (*_entry == NULL)
>> {
>> gnutls_assert ();
>> return GNUTLS_E_MEMORY_ERROR;
>> }
>> entry = *_entry;
>>
>> i do not understand this line
>> *_entry is allocated of the same size ?
>>
>> please answer me
>> _______________________________________________
>> Gnutls-devel mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/gnutls-devel
>
>
>
> _______________________________________________
> Gnutls-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnutls-devel


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
 
iQEcBAEBAgAGBQJQQS+JAAoJEHOWfvkM4ss/hEMIALjD+XWiSM6lzdyfdxl7fWH2
Mq6maxmooUki4zHz02qdZVe7rE6VRgdgX6gF2WZ4vMBkVXSMe/ng7HETuXllyXna
HoQNRhWgICQNLx94JNbCYRI8ArBvygxkJP8PtP48IX3TyYnSq0QA7UEx7Qy0TM+e
rcstaw5ACKx0WCSVn6quL46zKCwrmuH/iRov4+lLyq7fQYm2Vp0qR0sGg/wtByKB
hXLF+RQJ3aH+X9mDRwqFFBxz8nsulfPqbvryT/qyBpr0M1iAeHlt9TDiR3gOkOXq
jXpppaPsdBJM0mGkHcibiq+Q5JPOH0hDtPereLLaYgIuXwWrNmyV+pgOlvnzUGc=
=ZC8y
-----END PGP SIGNATURE-----


reply via email to

[Prev in Thread] Current Thread [Next in Thread]