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

Pavel Grunt pgrunt at redhat.com
Fri Feb 17 12:16:42 UTC 2017


On Fri, 2017-02-17 at 12:16 +0100, Christophe Fergeau wrote:
> 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;
> ?
yes, I do

> 
> 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.
> 

same here :) some "issues" come from the fact that we declare
variables at the beginning of a block - but I like this requirement

Pavel



> Christophe


More information about the Spice-devel mailing list