[Spice-devel] [spice-gtk v2] channel: Move local variables to inner block

Christophe Fergeau cfergeau at redhat.com
Fri Feb 17 11:16:34 UTC 2017


On Fri, Feb 17, 2017 at 11:35:07AM +0100, Pavel Grunt wrote:
> > @@ -2382,12 +2378,17 @@ static int
> > spice_channel_load_ca(SpiceChannel *channel)
> >      CHANNEL_DEBUG(channel, "Load CA, file: %s, data: %p", ca_file,
> > ca);
> >  
> >      if (ca != NULL) {
> > +        STACK_OF(X509_INFO) *inf;
> > +        X509_STORE *store;
> > +        BIO *in;
> > +
> >          store = SSL_CTX_get_cert_store(c->ctx);
> >          in = BIO_new_mem_buf(ca, size);
> >          inf = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
> >          BIO_free(in);
> >  
> >          for (i = 0; i < sk_X509_INFO_num(inf); i++) {
> > +            X509_INFO *itmp;
> >              itmp = sk_X509_INFO_value(inf, i);
> >              if (itmp->x509) {
> >                  X509_STORE_add_cert(store, itmp->x509);
> 
> 
> OT: Is there any preference about using declaration & definition, or
> just definition if possible ?

Do you mean
int foo = 4;
VS
int foo;
foo = 4;
?

For me it's a complicated question, I think I usually do the latter,
even if you ask me I'd say I prefer the former ;) The former sometimes
lead to overlong lines, which means you need to split sometimes.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170217/1966eaca/attachment.sig>


More information about the Spice-devel mailing list