3 ms·
The use of shorthand names like that is a strong indication that the variables don't need to be live for ~319 lines. If you reduce the live range of your varia
by ectoplasm 11y ago
The use of shorthand names like that is a strong indication that the variables don't need to be live for ~319 lines. If you reduce the live range of your variables, you reduce the complexity of your function. Less complex functions are less likely to have bugs and are easier to diagnose when they do.
- jfoster 11y agoGood points, but if you are able to do that, doesn't it suggest the function could easily be split into multiple, more specific functions?
- ectoplasm 11y agoYes, of course, it's just the first step. In fact you'd probably need to introduce a couple more variables. For example, i gets defined three times: i = sk_X509_num(ctx->chain); i = check_trust(ctx); i = X509_chain_check_suiteb(&ctx->error_depth, NULL, ctx->chain, ctx->param->flags); What a mess. I would probably start by moving towards a module / class for all the functions that take either an X509_STORE_CTX *ctx pointer or something accessed through ctx.