fix more style bogosities that have crept in

This commit is contained in:
Kurtis Rader 2016-10-10 19:52:22 -07:00
parent 36f320598e
commit cda415cb5d
6 changed files with 11 additions and 10 deletions

View File

@ -2860,7 +2860,7 @@ static bool set_hist_cmd(wchar_t *const cmd, hist_cmd_t *hist_cmd, hist_cmd_t su
break; \
} \
if (args.size() != 0) { \
streams.err.append_format(BUILTIN_ERR_ARG_COUNT2, cmd, \
streams.err.append_format(BUILTIN_ERR_ARG_COUNT2, cmd, \
hist_cmd_to_string(hist_cmd).c_str(), 0, args.size()); \
status = STATUS_BUILTIN_ERROR; \
break; \

View File

@ -770,6 +770,9 @@ long convert_digit(wchar_t d, int base);
/// functions which need to accept parameters they do not use because they need to be compatible
/// with an interface. It's similar to the Python idiom of doing `_ = expr` at the top of a
/// function in the same situation.
#define UNUSED(expr) do { (void)(expr); } while (0)
#define UNUSED(expr) \
do { \
(void)(expr); \
} while (0)
#endif

View File

@ -573,7 +573,7 @@ static size_t offset_of_next_item_fish_2_0(const char *begin, size_t mmap_length
const char *cmd_when = "- cmd: when:";
const size_t cmd_when_len = strlen(cmd_when);
if ((size_t)(a_newline - line_start) >= cmd_when_len &&
!memcmp(line_start, cmd_when, cmd_when_len)) {
!memcmp(line_start, cmd_when, cmd_when_len)) {
continue;
}
@ -1661,8 +1661,7 @@ static int threaded_perform_file_detection(file_detection_context_t *ctx) {
return ctx->perform_file_detection(true /* test all */);
}
static void perform_file_detection_done(file_detection_context_t *ctx,
int success) {
static void perform_file_detection_done(file_detection_context_t *ctx, int success) {
UNUSED(success);
ASSERT_IS_MAIN_THREAD();

View File

@ -185,8 +185,6 @@ class lru_cache_t {
public:
explicit iterator(lru_node_t *val) : node(val) {}
void operator++() { node = lru_cache_t::get_previous(node); }
//WTF
//void operator++(int x) { node = lru_cache_t::get_previous(node); }
bool operator==(const iterator &other) { return node == other.node; }
bool operator!=(const iterator &other) { return !(*this == other); }
node_type_t *operator*() { return static_cast<node_type_t *>(node); }

View File

@ -205,7 +205,8 @@ size_t escape_code_length(const wchar_t *code) {
bool found = false;
if (cur_term != NULL) {
// Detect these terminfo color escapes with parameter value up to max_colors-1, all of which don't move
// Detect these terminfo color escapes with parameter value up to max_colors-1, all of which
// don't move
// the cursor.
char *const esc[] = {
set_a_foreground, set_a_background, set_foreground, set_background,
@ -773,7 +774,7 @@ static void s_update(screen_t *scr, const wchar_t *left_prompt, const wchar_t *r
// to the sticky right cursor. If we clear the screen too early, we can defeat soft
// wrapping.
if (j + 1 == (size_t)screen_width && should_clear_screen_this_line &&
!has_cleared_screen) {
!has_cleared_screen) {
s_move(scr, &output, current_width, (int)i);
s_write_mbs(&output, clr_eos);
has_cleared_screen = true;

View File

@ -31,7 +31,7 @@
// 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;
#define UTF8_WCHAR_MAX (wchar_t)std::numeric_limits<utf8_wchar_t>::max()
#define UTF8_WCHAR_MAX (wchar_t) std::numeric_limits<utf8_wchar_t>::max()
typedef std::basic_string<utf8_wchar_t> utf8_wstring_t;