Mercurial > octave
changeset 28921:967cfcde2e35
maint: Use parentheses around conditional expressions.
* memory.m, tar_is_bsd.m, runge_kutta_23s.m,
load_packages_and_dependencies.m, unload_packages.m, camlookat.m, camorbit.m,
__unite_shared_vertices__.m, streamribbon.m, struct2hdl.m, __alltohandles__.m,
webwrite.m:
Use parentheses around conditional expressions
author | Rik <rik@octave.org> |
---|---|
date | Tue, 13 Oct 2020 23:26:17 -0700 |
parents | 601b6c7728ed |
children | c68b077c8fd6 |
files | scripts/miscellaneous/memory.m scripts/miscellaneous/private/tar_is_bsd.m scripts/ode/private/runge_kutta_23s.m scripts/pkg/private/load_packages_and_dependencies.m scripts/pkg/private/unload_packages.m scripts/plot/appearance/camlookat.m scripts/plot/appearance/camorbit.m scripts/plot/draw/private/__unite_shared_vertices__.m scripts/plot/draw/streamribbon.m scripts/plot/util/struct2hdl.m scripts/sparse/private/__alltohandles__.m scripts/web/webwrite.m |
diffstat | 12 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/memory.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/miscellaneous/memory.m Tue Oct 13 23:26:17 2020 -0700 @@ -160,7 +160,7 @@ total_ram = meminfo.MemTotal * kiB; total_swap = meminfo.SwapTotal * kiB; free_ram = meminfo.MemFree * kiB; - if isfield (meminfo, "MemAvailable") + if (isfield (meminfo, "MemAvailable")) available_ram = meminfo.MemAvailable * kiB; else ## On kernels from before 2014 MemAvailable is not present.
--- a/scripts/miscellaneous/private/tar_is_bsd.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/miscellaneous/private/tar_is_bsd.m Tue Oct 13 23:26:17 2020 -0700 @@ -38,7 +38,7 @@ function out = tar_is_bsd () ## BSD tar needs to be handled differently from GNU tar persistent cache - if isempty (cache) + if (isempty (cache)) [status, tar_ver_str] = system ("tar --version"); if (status) error ("tar: Failed executing tar --version (status = %d)", status);
--- a/scripts/ode/private/runge_kutta_23s.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/ode/private/runge_kutta_23s.m Tue Oct 13 23:26:17 2020 -0700 @@ -128,7 +128,7 @@ endif W = M - dt*d*J; - if issparse (W) + if (issparse (W)) [Lw, Uw, Pw, Qw, Rw] = lu (W); else [Lw, Uw, Pw] = lu (W); @@ -136,13 +136,13 @@ ## compute the slopes F(:,1) = feval (fun, t, x, args{:}); - if issparse (W) + if (issparse (W)) k(:,1) = Qw * (Uw \ (Lw \ (Pw * (Rw \ (F(:,1) + dt*d*T))))); else k(:,1) = Uw \ (Lw \ (Pw * (F(:,1) + dt*d*T))); endif F(:,2) = feval (fun, t+a*dt, x+a*dt*k(:,1), args{:}); - if issparse (W) + if (issparse (W)) k(:,2) = Uw * (Uw \ (Lw \ (Pw * (Rw \ (F(:,2) - M*k(:,1)))))) + k(:,1); else k(:,2) = Uw \ (Lw \ (Pw * (F(:,2) - M*k(:,1)))) + k(:,1); @@ -154,7 +154,7 @@ if (nargout >= 3) ## 3rd order, needed in error formula F(:,3) = feval (fun, t+dt, x_next, args{:}); - if issparse (W) + if (issparse (W)) k(:,3) = Qw * (Uw \ (Lw \ (Pw * (Rw \ (F(:,3) - e32 * (M*k(:,2) - F(:,2)) - 2 * (M*k(:,1) - F(:,1)) + dt*d*T))))); else k(:,3) = Uw \ (Lw \ (Pw * (F(:,3) - e32 * (M*k(:,2) - F(:,2)) - 2 * (M*k(:,1) - F(:,1)) + dt*d*T)));
--- a/scripts/pkg/private/load_packages_and_dependencies.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/pkg/private/load_packages_and_dependencies.m Tue Oct 13 23:26:17 2020 -0700 @@ -62,7 +62,7 @@ endif ## Update lexer for autocompletion if necessary - if isguirunning && (length (idx) > 0) + if (isguirunning && (length (idx) > 0)) __event_manager_update_gui_lexer__; endif
--- a/scripts/pkg/private/unload_packages.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/pkg/private/unload_packages.m Tue Oct 13 23:26:17 2020 -0700 @@ -100,7 +100,7 @@ if (any (idx)) rmpath (d); ## FIXME: We should also check if we need to remove items from EXEC_PATH. - if isguirunning + if (isguirunning) __event_manager_update_gui_lexer__; endif endif
--- a/scripts/plot/appearance/camlookat.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/plot/appearance/camlookat.m Tue Oct 13 23:26:17 2020 -0700 @@ -62,7 +62,7 @@ hh = get (hax, "children"); elseif (all (ishghandle (hh))) hax = ancestor (hh, "axes"); - if numel (hax) > 1 + if (numel (hax) > 1) hax = unique ([hax{:}]); endif if (numel (hax) > 1)
--- a/scripts/plot/appearance/camorbit.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/plot/appearance/camorbit.m Tue Oct 13 23:26:17 2020 -0700 @@ -138,7 +138,7 @@ endif if (ischar (dir)) - switch tolower (dir) + switch (tolower (dir)) case "x" dir = [1 0 0]; case "y"
--- a/scripts/plot/draw/private/__unite_shared_vertices__.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/plot/draw/private/__unite_shared_vertices__.m Tue Oct 13 23:26:17 2020 -0700 @@ -55,7 +55,7 @@ [J, idx] = sort (J); j(idx) = 1:length (idx); vertices = vertices(idx,:); - if any (nan_vertices) + if (any (nan_vertices)) j(end+1) = length (idx) + 1; vertices(end+1,:) = NaN; lut(nan_vertices) = rows (vertices);
--- a/scripts/plot/draw/streamribbon.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/plot/draw/streamribbon.m Tue Oct 13 23:26:17 2020 -0700 @@ -235,7 +235,7 @@ sl = xyz{i}; num_vertices = rows (sl); if (! isempty (sl) && num_vertices > 1) - if isempty (anlr_rot) + if (isempty (anlr_rot)) ## Plot from vector field ## Interpolate onto streamline vertices [lin_spd_sl, anlr_spd_sl, max_vertices] = ...
--- a/scripts/plot/util/struct2hdl.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/plot/util/struct2hdl.m Tue Oct 13 23:26:17 2020 -0700 @@ -138,7 +138,7 @@ ## Translate field names for Matlab .fig files ## FIXME: Is it ok to do this unconditionally? - if isfield (s.properties, "applicationdata") + if (isfield (s.properties, "applicationdata")) s.properties.__appdata__ = s.properties.applicationdata; s.properties = rmfield (s.properties, "applicationdata"); endif
--- a/scripts/sparse/private/__alltohandles__.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/sparse/private/__alltohandles__.m Tue Oct 13 23:26:17 2020 -0700 @@ -75,7 +75,7 @@ ## Check M1 and sets its type if (isempty (M1)) # M1 empty, set to identity function - switch solver_name + switch (solver_name) case {"pcg", "gmres", "bicgstab", "cgs", "tfqmr"} ## methods which do not require the transpose M1fun = @(x) x; @@ -98,7 +98,7 @@ endif if (isempty (M2)) # M2 empty, then I set is to the identity function - switch solver_name + switch (solver_name) case {"pcg", "gmres", "bicgstab", "cgs", "tfqmr"} ## methods which do not require the transpose M2fun = @(x) x; @@ -120,7 +120,7 @@ endif endif - switch solver_name + switch (solver_name) case {"pcg", "gmres", "bicgstab", "cgs", "tfqmr"} ## methods which do not require the transpose if (A_is_numeric)
--- a/scripts/web/webwrite.m Tue Oct 13 23:19:09 2020 -0700 +++ b/scripts/web/webwrite.m Tue Oct 13 23:26:17 2020 -0700 @@ -94,7 +94,7 @@ if (ischar (varargin{1}) && isrow (varargin{1})) param = strsplit (varargin{1}, {"=", "&"}); response = __restful_service__ (url, param, options); - elseif (! iscellstr (varargin)) + elseif (! iscellstr (varargin)) error ("webwrite: DATA must be a string"); else response = __restful_service__ (url, varargin, options);