[clang-tidy] Use C++ using instead of C typedef

Found with modernize-use-using

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2019-11-25 16:56:39 -08:00 committed by ridiculousfish
parent 7d1cc992e5
commit 6f4a9d527c
13 changed files with 19 additions and 19 deletions

View file

@ -1222,7 +1222,7 @@ static int string_sub(parser_t &parser, io_streams_t &streams, int argc, wchar_t
int nsub = 0;
arg_iterator_t aiter(argv, optind, streams);
while (const wcstring *s = aiter.nextstr()) {
typedef wcstring::size_type size_type;
using size_type = wcstring::size_type;
size_type pos = 0;
size_type count = wcstring::npos;
if (opts.start > 0) {

View file

@ -124,7 +124,7 @@ typedef struct complete_entry_opt {
static std::atomic<unsigned int> k_complete_order{0};
/// Struct describing a command completion.
typedef std::list<complete_entry_opt_t> option_list_t;
using option_list_t = std::list<complete_entry_opt_t>;
class completion_entry_t {
public:
/// List of all options.
@ -166,7 +166,7 @@ struct equal_to<completion_entry_t> {
}
};
} // namespace std
typedef std::unordered_set<completion_entry_t> completion_entry_set_t;
using completion_entry_set_t = std::unordered_set<completion_entry_t>;
static owning_lock<completion_entry_set_t> s_completion_set;
/// Completion "wrapper" support. The map goes from wrapping-command to wrapped-command-list.

View file

@ -47,7 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#define SPACES_PER_INDENT 4
// An indent_t represents an abstract indent depth. 2 means we are in a doubly-nested block, etc.
typedef unsigned int indent_t;
using indent_t = unsigned int;
static bool dump_parse_tree = false;
static int ret = 0;

View file

@ -774,7 +774,7 @@ class highlighter_t {
// Working directory.
const wcstring working_directory;
// The resulting colors.
typedef std::vector<highlight_spec_t> color_array_t;
using color_array_t = std::vector<highlight_spec_t>;
color_array_t color_array;
// The parse tree of the buff.
parse_node_tree_t parse_tree;

View file

@ -41,7 +41,7 @@
static void iothread_service_main_thread_requests();
static void iothread_service_result_queue();
typedef std::function<void(void)> void_function_t;
using void_function_t = std::function<void()>;
struct work_request_t {
void_function_t handler;

View file

@ -15,7 +15,7 @@
#include "fallback.h" // IWYU pragma: keep
/** Kill ring */
typedef std::list<wcstring> kill_list_t;
using kill_list_t = std::list<wcstring>;
static kill_list_t kill_list;
void kill_add(wcstring str) {

View file

@ -20,9 +20,9 @@
#include "screen.h"
#include "wutil.h" // IWYU pragma: keep
typedef pager_t::comp_t comp_t;
typedef std::vector<completion_t> completion_list_t;
typedef std::vector<comp_t> comp_info_list_t;
using comp_t = pager_t::comp_t;
using completion_list_t = std::vector<completion_t>;
using comp_info_list_t = std::vector<comp_t>;
/// The minimum width (in characters) the terminal must to show completions at all.
#define PAGER_MIN_WIDTH 16

View file

@ -9,7 +9,7 @@
#include "common.h"
#include "fallback.h" // IWYU pragma: keep
typedef std::unordered_set<wcstring> string_set_t;
using string_set_t = std::unordered_set<wcstring>;
static const wcstring skip_keywords[]{
L"else",

View file

@ -290,7 +290,7 @@ io_chain_t job_t::all_io_redirections() const {
return result;
}
typedef unsigned int process_generation_count_t;
using process_generation_count_t = unsigned int;
/// A list of pids/pgids that have been disowned. They are kept around until either they exit or
/// we exit. Poll these from time-to-time to prevent zombie processes from happening (#5342).

View file

@ -38,9 +38,9 @@
// TODO: It would be nice not to rely on a typedef for this, especially one that can only do
// functions with two args.
typedef double (*te_fun2)(double, double);
typedef double (*te_fun1)(double);
typedef double (*te_fun0)();
using te_fun2 = double (*)(double, double);
using te_fun1 = double (*)(double);
using te_fun0 = double (*)();
enum {
TE_CONSTANT = 0,

View file

@ -33,10 +33,10 @@
#define _BOM 0xfeff
// We can tweak the following typedef to allow us to simulate Windows-style 16 bit wchar's on Unix.
typedef wchar_t utf8_wchar_t;
using utf8_wchar_t = wchar_t;
#define UTF8_WCHAR_MAX (wchar_t) std::numeric_limits<utf8_wchar_t>::max()
typedef std::basic_string<utf8_wchar_t> utf8_wstring_t;
using utf8_wstring_t = std::basic_string<utf8_wchar_t>;
static size_t utf8_to_wchar_internal(const char *in, size_t insize, utf8_wstring_t *out_string,
int flags);

View file

@ -7,7 +7,7 @@
#include "common.h"
typedef wcstring::size_type size_type;
using size_type = wcstring::size_type;
wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) {
size_type pos = last.second == wcstring::npos ? wcstring::npos : last.first;

View file

@ -31,7 +31,7 @@
#include "flog.h"
#include "wutil.h" // IWYU pragma: keep
typedef std::string cstring;
using cstring = std::string;
const file_id_t kInvalidFileID = {static_cast<dev_t>(-1LL),
static_cast<ino_t>(-1LL),