Mercurial > hg > octave-kai
changeset 8503:8ba2ee57c594
remove qsort in favor of sort
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 13 Jan 2009 12:16:21 +0100 |
parents | d437e8dc18fa |
children | 0e0bd07e6ae2 |
files | liboctave/Array.h liboctave/ChangeLog liboctave/glob-match.cc liboctave/str-vec.cc liboctave/str-vec.h src/ChangeLog src/dirfns.cc src/graphics.cc src/help.cc src/input.cc src/oct-map.cc src/ov-fcn-inline.cc src/variables.cc |
diffstat | 13 files changed, 33 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -91,11 +91,6 @@ T elem (octave_idx_type n) const { return data[n]; } - void qsort (int (*compare) (const void *, const void *)) - { - octave_qsort (data, static_cast<size_t> (len), sizeof (T), compare); - } - private: // No assignment! @@ -418,15 +413,6 @@ T *fortran_vec (void); - Array<T>& qsort (int (*compare) (const void *, const void *)) - { - make_unique (); - - rep->qsort (compare); - - return *this; - } - int ndims (void) const { return dimensions.length (); } void maybe_delete_dims (void);
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,12 @@ +2009-01-13 Jaroslav Hajek <highegg@gmail.com> + + * Array.h (Array::ArrayRep::qsort): Remove. + (Array::qsort): Remove. + * glob-match.cc (glob_match::glob): qsort -> sort. + * str-vec.cc (string_vector::compare): Remove. + * str-vec.h (string_vector::compare): Remove decl. + (string_vector::qsort): Rename to sort, call Array::sort. + 2008-12-23 David Bateman <dbateman@free.fr> * eigs-base.cc: New file with template wrapper for ARPACK.
--- a/liboctave/glob-match.cc +++ b/liboctave/glob-match.cc @@ -125,7 +125,7 @@ } } - return retval.qsort (); + return retval.sort (); } /*
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -83,15 +83,6 @@ elem (i) = s[i]; } -int -string_vector::compare (const void *a_arg, const void *b_arg) -{ - const std::string *a = static_cast<const std::string *> (a_arg); - const std::string *b = static_cast<const std::string *> (b_arg); - - return a->compare (*b); -} - string_vector& string_vector::uniq (void) {
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -84,11 +84,9 @@ std::string operator[] (octave_idx_type i) const { return Array<std::string>::elem (i); } - static int compare (const void *a_arg, const void *b_arg); - - string_vector& qsort (bool make_uniq = false) + string_vector& sort (bool make_uniq = false) { - Array<std::string>::qsort (compare); + Array<std::string>::sort (); if (make_uniq) uniq ();
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2009-01-13 Jaroslav Hajek <highegg@gmail.com> + + * dirfns.cc (Freadddir): qsort -> sort. + * graphics.cc (maybe_set_children): Dtto. + * help.cc (simple_help): Dtto. + * input.cc (generate_possible_completions): Dtto. + * oct_map.cc (keys_ok): Dtto. + * ov-fcn-inline.cc (Finline): Dtto. + * variables.cc (Fisrawcommand): Dtto. + 2009-01-12 John W. Eaton <jwe@octave.org> * octave.cc (maximum_braindamage): Set confirm_recursive_rmdir to
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -188,7 +188,7 @@ if (dir) { string_vector dirlist = dir.read (); - retval(0) = Cell (dirlist.qsort ()); + retval(0) = Cell (dirlist.sort ()); retval(1) = 0.0; } else
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -1520,15 +1520,6 @@ } // --------------------------------------------------------------------- -static int -compare (const void *a_arg, const void *b_arg) -{ - double a = *(static_cast<const double *> (a_arg)); - double b = *(static_cast<const double *> (b_arg)); - - return a > b ? 1 : (a < b) ? -1 : 0; -} - static Matrix maybe_set_children (const Matrix& kids, const octave_value& val) { @@ -1543,8 +1534,8 @@ Matrix t1 = kids; Matrix t2 = new_kids; - t1.qsort (compare); - t2.qsort (compare); + t1.sort (); + t2.sort (); if (t1 != t2) ok = false;
--- a/src/help.cc +++ b/src/help.cc @@ -646,7 +646,7 @@ { os << "\n*** " << desc << ":\n\n"; - symbols.qsort (); + symbols.sort (); symbols.list_in_columns (os); } @@ -693,7 +693,7 @@ { octave_stdout << "\n*** autoloaded functions:\n\n"; - autoloaded.qsort (); + autoloaded.sort (); autoloaded.list_in_columns (octave_stdout); }
--- a/src/input.cc +++ b/src/input.cc @@ -447,7 +447,7 @@ // Sort and remove duplicates. - names.qsort (true); + names.sort (true); return names; }
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -255,8 +255,8 @@ } else { - string_vector a_keys = a.keys().qsort (); - string_vector b_keys = b.keys().qsort (); + string_vector a_keys = a.keys().sort (); + string_vector b_keys = b.keys().sort (); octave_idx_type a_len = a_keys.length (); octave_idx_type b_len = b_keys.length ();
--- a/src/ov-fcn-inline.cc +++ b/src/ov-fcn-inline.cc @@ -711,7 +711,7 @@ } // Sort the arguments into ascii order. - fargs.qsort (); + fargs.sort (); } else if (nargin == 2 && args(1).is_numeric_type ()) {
--- a/src/variables.cc +++ b/src/variables.cc @@ -208,7 +208,7 @@ p != command_set.end (); p++) lst[i++] = *p; - retval = Cell (lst.qsort ()); + retval = Cell (lst.sort ()); } else if (nargin == 1) { @@ -349,7 +349,7 @@ p++) lst[i++] = *p; - retval = Cell (lst.qsort ()); + retval = Cell (lst.sort ()); } else if (nargin == 1) {