# HG changeset patch # User jwe # Date 1095866317 0 # Node ID 1009e55429bccfb506708b75d5a72fc05ce33158 # Parent 89814b22b729ed3310829b3bdaf42f4936a4e5ba [project @ 2004-09-22 15:18:37 by jwe] diff -r 89814b22b729 -r 1009e55429bc src/ov-fcn-inline.cc --- a/src/ov-fcn-inline.cc Wed Sep 22 15:12:02 2004 +0000 +++ b/src/ov-fcn-inline.cc Wed Sep 22 15:18:37 2004 +0000 @@ -603,25 +603,27 @@ if (nargin == 1) { int dist = -1; - char c; + char c = '\0'; fargs.resize (1); fargs(0) = "x"; - for (int i = 0; i < fun.length (); i++) + int fun_len = fun.length (); + + for (int i = 0; i < fun_len; i++) { if (islower (fun[i]) && (i == 0 || ! islower (fun[i-1])) - && (i == fun.length () || ! islower (fun[i+1]))) + && (i == fun_len || ! islower (fun[i+1]))) { - char new_c = fun [i]; + char new_c = fun[i]; if (new_c == 'i' || new_c == 'j') continue; int new_dist = std::abs (new_c - 'x'); - if (dist == -1 || (new_dist < dist) + if (dist == -1 || new_dist < dist || (new_dist == dist && c < new_c)) { fargs(0) = new_c;