mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Replace all printf invocations with wprintf
Remember, GNU doesn't allow mixing narrow and wide IO.
This commit is contained in:
parent
69005f8c60
commit
177e06808c
10 changed files with 11 additions and 11 deletions
|
@ -25,7 +25,7 @@
|
|||
static const int kAutoloadStalenessInterval = 15;
|
||||
|
||||
file_access_attempt_t access_file(const wcstring &path, int mode) {
|
||||
// printf("Touch %ls\n", path.c_str());
|
||||
// wprintf(L"Touch %ls\n", path.c_str());
|
||||
file_access_attempt_t result = {};
|
||||
struct stat statbuf;
|
||||
if (wstat(path, &statbuf)) {
|
||||
|
|
|
@ -608,7 +608,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
|||
param7, param8, param9, param10, param11, param12};
|
||||
if (!msg) return;
|
||||
|
||||
// Can't call printf, that may allocate memory Just call write() over and over.
|
||||
// Can't call wprintf, that may allocate memory Just call write() over and over.
|
||||
if (level > debug_level) return;
|
||||
int errno_old = errno;
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ bool is_forked_child(void) {
|
|||
|
||||
bool is_child_of_fork = (getpid() != initial_pid);
|
||||
if (is_child_of_fork) {
|
||||
printf("Uh-oh: %d\n", getpid());
|
||||
wprintf(L"Uh-oh: %d\n", getpid());
|
||||
while (1) sleep(10000);
|
||||
}
|
||||
return is_child_of_fork;
|
||||
|
|
|
@ -166,7 +166,7 @@ static void show_all_handlers(void) {
|
|||
for (event_list_t::const_iterator iter = events.begin(); iter != events.end(); ++iter) {
|
||||
const event_t *foo = *iter;
|
||||
wcstring tmp = event_get_desc(foo);
|
||||
printf(" handler now %ls\n", tmp.c_str());
|
||||
wprintf(L" handler now %ls\n", tmp.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -763,7 +763,7 @@ static int expand_variables(const wcstring &instr, std::vector<completion_t> *ou
|
|||
stop_pos++;
|
||||
}
|
||||
|
||||
// printf( "Stop for '%c'\n", in[stop_pos]);
|
||||
// wprintf(L"Stop for '%c'\n", in[stop_pos]);
|
||||
var_len = stop_pos - start_pos;
|
||||
|
||||
if (var_len == 0) {
|
||||
|
|
|
@ -183,7 +183,7 @@ static void output_info_about_char(wchar_t wc) {
|
|||
static bool output_matching_key_name(wchar_t wc) {
|
||||
char *name = sequence_name(wc);
|
||||
if (name) {
|
||||
printf("bind -k %s 'do something'\n", name);
|
||||
wprintf(L"bind -k %s 'do something'\n", name);
|
||||
free(name);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1726,7 +1726,7 @@ static void test_1_word_motion(word_motion_t motion, move_word_style_t style,
|
|||
size_t char_idx = (motion == word_motion_left ? idx - 1 : idx);
|
||||
wchar_t wc = command.at(char_idx);
|
||||
bool will_stop = !sm.consume_char(wc);
|
||||
// printf("idx %lu, looking at %lu (%c): %d\n", idx, char_idx, (char)wc, will_stop);
|
||||
// wprintf(L"idx %lu, looking at %lu (%c): %d\n", idx, char_idx, (char)wc, will_stop);
|
||||
bool expected_stop = (stops.count(idx) > 0);
|
||||
if (will_stop != expected_stop) {
|
||||
wcstring tmp = command;
|
||||
|
|
|
@ -275,7 +275,7 @@ void iothread_drain_all(void) {
|
|||
}
|
||||
#if TIME_DRAIN
|
||||
double after = timef();
|
||||
printf("(Waited %.02f msec for %d thread(s) to drain)\n", 1000 * (after - now), thread_count);
|
||||
wprintf(L"(Waited %.02f msec for %d thread(s) to drain)\n", 1000 * (after - now), thread_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ rgb_color_t parse_color(const wcstring &val, bool is_background) {
|
|||
|
||||
#if 0
|
||||
wcstring desc = result.description();
|
||||
printf("Parsed %ls from %ls (%s)\n", desc.c_str(), val.c_str(),
|
||||
wprintf(L"Parsed %ls from %ls (%s)\n", desc.c_str(), val.c_str(),
|
||||
is_background ? "background" : "foreground");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void print_jobs(void)
|
|||
job_iterator_t jobs;
|
||||
job_t *j;
|
||||
while (j = jobs.next()) {
|
||||
printf("%p -> %ls -> (foreground %d, complete %d, stopped %d, constructed %d)\n",
|
||||
wprintf("%p -> %ls -> (foreground %d, complete %d, stopped %d, constructed %d)\n",
|
||||
j, j->command_wcstr(), job_get_flag(j, JOB_FOREGROUND), job_is_completed(j),
|
||||
job_is_stopped(j), job_get_flag(j, JOB_CONSTRUCTED));
|
||||
}
|
||||
|
|
|
@ -666,7 +666,7 @@ bool move_word_state_machine_t::consume_char_path_components(wchar_t c) {
|
|||
s_end
|
||||
};
|
||||
|
||||
// printf("state %d, consume '%lc'\n", state, c);
|
||||
// wprintf(L"state %d, consume '%lc'\n", state, c);
|
||||
bool consumed = false;
|
||||
while (state != s_end && !consumed) {
|
||||
switch (state) {
|
||||
|
|
Loading…
Reference in a new issue