Re: [spice-gtk 3/3] ssl: Use accessors rather than direct struct access

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

 



On Wed, 2017-01-11 at 10:15 +0100, Christophe Fergeau wrote:
> On Mon, Jan 09, 2017 at 03:38:43PM +0100, Pavel Grunt wrote:
> > > +static int BIO_get_new_index(void)
> > > +{
> > > +    return 128;
> > 
> > looking at openssl implementation
> > https://github.com/openssl/openssl/commit/8b8d963db5bb619fbada014f
> > 294f
> > d09a855a2650
> > 
> > it uses BIO_TYPE_START and increments when called
> > 
> 
> Are you suggesting that a constant and incremented static are
> introduced? Or is it fine to just keep things as they are now?

I am suggesting to introduce that, I would always think why "128" and
why is the new index same as the previous.

diff --git a/src/bio-gio.c b/src/bio-gio.c
index 1c8d267..6a9637c 100644
--- a/src/bio-gio.c
+++ b/src/bio-gio.c
@@ -54,9 +54,10 @@ static int BIO_meth_set_ctrl(BIO_METHOD *biom,
     return 1;
 }
 
+static int bio_index = BIO_TYPE_START;
 static int BIO_get_new_index(void)
 {
-    return 128;
+    return ++bio_index;
 }
 
 static void BIO_set_init(BIO *a, int init)




Pavel
> 
> Christophe
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]