comparison liboctave/util/kpse.cc @ 23450:855122b993da

maint: Wrap tertiary operator in parentheses "(COND ? x : y)". * Canvas.cc, color-picker.cc, dialog.cc, marker.cc, main-window.cc, Cell.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, bsxfun.cc, call-stack.cc, cellfun.cc, data.cc, defaults.cc, det.cc, eig.cc, error.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc, gl-render.cc, graphics.cc, graphics.in.h, help.cc, hex2num.cc, inv.cc, load-save.cc, lookup.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, lu.cc, max.cc, mex.cc, oct-hist.cc, oct-map.cc, oct-procbuf.cc, oct-stream.cc, pr-output.cc, rand.cc, regexp.cc, schur.cc, str2double.cc, strfns.cc, symtab.cc, sysdep.cc, tril.cc, variables.cc, xdiv.cc, audiodevinfo.cc, audioread.cc, colamd.cc, gzip.cc, ov-base-diag.cc, ov-base-mat.h, ov-base-scalar.h, ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-range.cc, ov-range.h, ov-struct.cc, ov-usr-fcn.cc, ov.cc, octave.cc, op-class.cc, pt-eval.cc, pt-funcall.cc, pt-idx.cc, pt-jit.cc, pt-stmt.cc, version.cc, Array-util.cc, Array.cc, CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CSparse.cc, Range.cc, Sparse.cc, chNDArray.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dSparse.cc, dim-vector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, idx-vector.cc, idx-vector.h, Faddeeva.cc, DASPK.cc, DASRT.cc, DASSL.cc, EIG.cc, fEIG.cc, gsvd.cc, lo-specfun.cc, oct-rand.cc, qr.cc, qrp.cc, randgamma.cc, schur.cc, svd.cc, Sparse-diag-op-defs.h, mx-inlines.cc, oct-env.cc, cmd-edit.cc, kpse.cc, oct-inttypes.h, oct-sort.cc: Wrap tertiary operator in parentheses "(COND ? x : y)".
author Rik <rik@octave.org>
date Thu, 27 Apr 2017 17:33:10 -0700
parents c9fab0bc983e
children 336f89b6208b
comparison
equal deleted inserted replaced
23449:c763214a8260 23450:855122b993da
712 /* We only need the cast here for (deficient) systems 712 /* We only need the cast here for (deficient) systems
713 which do not declare 'getpwnam' in <pwd.h>. */ 713 which do not declare 'getpwnam' in <pwd.h>. */
714 octave::sys::password p = octave::sys::password::getpwnam (user); 714 octave::sys::password p = octave::sys::password::getpwnam (user);
715 715
716 /* If no such user, just use '.'. */ 716 /* If no such user, just use '.'. */
717 std::string home = p ? p.dir () : std::string ("."); 717 std::string home = (p ? p.dir () : std::string ("."));
718 718
719 if (home.empty ()) 719 if (home.empty ())
720 home = "."; 720 home = ".";
721 721
722 /* handle leading // */ 722 /* handle leading // */
725 725
726 /* If HOME ends in /, omit the / after ~user. */ 726 /* If HOME ends in /, omit the / after ~user. */
727 if (name.length () > c && IS_DIR_SEP (home[home.length () - 1])) 727 if (name.length () > c && IS_DIR_SEP (home[home.length () - 1]))
728 c++; 728 c++;
729 729
730 expansion = name.length () > c ? home : home + name.substr (c); 730 expansion = (name.length () > c ? home : home + name.substr (c));
731 } 731 }
732 #else /* not HAVE_PWD_H */ 732 #else /* not HAVE_PWD_H */
733 expansion = name; 733 expansion = name;
734 #endif /* not HAVE_PWD_H */ 734 #endif /* not HAVE_PWD_H */
735 735
1145 expansion = fallback; 1145 expansion = fallback;
1146 1146
1147 /* Solitary or leading :? */ 1147 /* Solitary or leading :? */
1148 else if (IS_ENV_SEP (path[0])) 1148 else if (IS_ENV_SEP (path[0]))
1149 { 1149 {
1150 expansion = path_len == 1 ? fallback : fallback + path; 1150 expansion = (path_len == 1 ? fallback : fallback + path);
1151 } 1151 }
1152 1152
1153 /* Sorry about the assignment in the middle of the expression, but 1153 /* Sorry about the assignment in the middle of the expression, but
1154 conventions were made to be flouted and all that. I don't see the 1154 conventions were made to be flouted and all that. I don't see the
1155 point of calling strlen twice or complicating the logic just to 1155 point of calling strlen twice or complicating the logic just to