[Spice-devel] [spice-gtk 3/3] ssl: Use accessors rather than direct struct access
Pavel Grunt
pgrunt at redhat.com
Wed Jan 11 09:24:55 UTC 2017
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
More information about the Spice-devel
mailing list