diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2020-08-10 23:48:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-12 20:40:59 +0200 |
commit | 0248ddc427c3e100226c733b9209c902312cdf73 (patch) | |
tree | ca2aeada63801b998e9def4e35ee0a16e0860b78 | |
parent | 5574d45edabed5b5d7f1a29455bdd5c495a30ae8 (diff) | |
download | serenity-0248ddc427c3e100226c733b9209c902312cdf73.zip |
Userland: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
-rw-r--r-- | Userland/allocate.cpp | 2 | ||||
-rw-r--r-- | Userland/cal.cpp | 6 | ||||
-rw-r--r-- | Userland/copy.cpp | 2 | ||||
-rw-r--r-- | Userland/disk_benchmark.cpp | 6 | ||||
-rw-r--r-- | Userland/find.cpp | 20 | ||||
-rw-r--r-- | Userland/functrace.cpp | 8 | ||||
-rw-r--r-- | Userland/id.cpp | 10 | ||||
-rw-r--r-- | Userland/ifconfig.cpp | 2 | ||||
-rw-r--r-- | Userland/js.cpp | 16 | ||||
-rw-r--r-- | Userland/ls.cpp | 10 | ||||
-rw-r--r-- | Userland/lsof.cpp | 4 | ||||
-rw-r--r-- | Userland/more.cpp | 2 | ||||
-rw-r--r-- | Userland/mount.cpp | 10 | ||||
-rw-r--r-- | Userland/ping.cpp | 2 | ||||
-rw-r--r-- | Userland/rm.cpp | 2 | ||||
-rw-r--r-- | Userland/seq.cpp | 2 | ||||
-rw-r--r-- | Userland/sleep.cpp | 2 | ||||
-rw-r--r-- | Userland/tail.cpp | 4 | ||||
-rw-r--r-- | Userland/tree.cpp | 2 | ||||
-rw-r--r-- | Userland/unzip.cpp | 6 | ||||
-rw-r--r-- | Userland/watch.cpp | 44 | ||||
-rw-r--r-- | Userland/wc.cpp | 6 |
22 files changed, 85 insertions, 83 deletions
diff --git a/Userland/allocate.cpp b/Userland/allocate.cpp index b047f51d19..cb712b8b3d 100644 --- a/Userland/allocate.cpp +++ b/Userland/allocate.cpp @@ -31,7 +31,7 @@ #include <string.h> #include <unistd.h> -void usage(void) +static void usage(void) { printf("usage: allocate [number [unit (B/KB/MB)]]\n"); exit(1); diff --git a/Userland/cal.cpp b/Userland/cal.cpp index 4f14a33ba6..679a42be61 100644 --- a/Userland/cal.cpp +++ b/Userland/cal.cpp @@ -44,7 +44,7 @@ int target_day; int current_year; int current_month; -void append_to_print(char* buffer, int row, int column, char* text) +static void append_to_print(char* buffer, int row, int column, char* text) { int starting_point = (line_width * row) + (column * column_width); for (int i = 0; text[i] != '\0'; i++) { @@ -52,7 +52,7 @@ void append_to_print(char* buffer, int row, int column, char* text) } } -void insert_month_to_print(int column, int month, int year) +static void insert_month_to_print(int column, int month, int year) { int printing_column = column; int printing_row = 0; @@ -95,7 +95,7 @@ void insert_month_to_print(int column, int month, int year) } } -void clean_buffers() +static void clean_buffers() { for (int i = 1; i < line_width * line_count; ++i) { print_buffer[i - 1] = i % line_width == 0 ? '\n' : ' '; diff --git a/Userland/copy.cpp b/Userland/copy.cpp index f0d94dc50d..8ef129bece 100644 --- a/Userland/copy.cpp +++ b/Userland/copy.cpp @@ -39,7 +39,7 @@ struct Options { StringView type; }; -Options parse_options(int argc, char* argv[]) +static Options parse_options(int argc, char* argv[]) { const char* type = "text/plain"; Vector<const char*> text; diff --git a/Userland/disk_benchmark.cpp b/Userland/disk_benchmark.cpp index 59798cd176..de3ff19849 100644 --- a/Userland/disk_benchmark.cpp +++ b/Userland/disk_benchmark.cpp @@ -42,7 +42,7 @@ struct Result { u64 read_bps; }; -Result average_result(const Vector<Result>& results) +static Result average_result(const Vector<Result>& results) { Result average; @@ -57,13 +57,13 @@ Result average_result(const Vector<Result>& results) return average; } -void exit_with_usage(int rc) +static void exit_with_usage(int rc) { fprintf(stderr, "Usage: disk_benchmark [-h] [-d directory] [-t time_per_benchmark] [-f file_size1,file_size2,...] [-b block_size1,block_size2,...]\n"); exit(rc); } -Result benchmark(const String& filename, int file_size, int block_size, ByteBuffer& buffer, bool allow_cache); +static Result benchmark(const String& filename, int file_size, int block_size, ByteBuffer& buffer, bool allow_cache); int main(int argc, char** argv) { diff --git a/Userland/find.cpp b/Userland/find.cpp index 0dce553689..baee2887a0 100644 --- a/Userland/find.cpp +++ b/Userland/find.cpp @@ -40,7 +40,7 @@ bool g_follow_symlinks = false; bool g_there_was_an_error = false; bool g_have_seen_action_command = false; -[[noreturn]] void fatal_error(const char* format, ...) +[[noreturn]] static void fatal_error(const char* format, ...) { fputs("\033[31m", stderr); @@ -143,7 +143,7 @@ public: m_uid = passwd->pw_uid; } else { // Attempt to parse it as decimal UID. - auto number = StringView(arg).to_uint(); + auto number = StringView(arg).to_uint(); if (!number.has_value()) fatal_error("Invalid user: \033[1m%s", arg); m_uid = number.value(); @@ -309,11 +309,11 @@ private: NonnullOwnPtr<Command> m_rhs; }; -OwnPtr<Command> parse_complex_command(char* argv[]); +static OwnPtr<Command> parse_complex_command(char* argv[]); // Parse a simple command starting at optind; leave optind at its the last // argument. Return nullptr if we reach the end of arguments. -OwnPtr<Command> parse_simple_command(char* argv[]) +static OwnPtr<Command> parse_simple_command(char* argv[]) { StringView arg = argv[optind]; @@ -352,14 +352,16 @@ OwnPtr<Command> parse_simple_command(char* argv[]) } } -OwnPtr<Command> parse_complex_command(char* argv[]) +static OwnPtr<Command> parse_complex_command(char* argv[]) { auto command = parse_simple_command(argv); while (command && argv[optind] && argv[optind + 1]) { StringView arg = argv[++optind]; - enum { And, Or } binary_operation = And; + enum { And, + Or } binary_operation + = And; if (arg == "-a") { optind++; @@ -389,7 +391,7 @@ OwnPtr<Command> parse_complex_command(char* argv[]) return command; } -NonnullOwnPtr<Command> parse_all_commands(char* argv[]) +static NonnullOwnPtr<Command> parse_all_commands(char* argv[]) { auto command = parse_complex_command(argv); @@ -405,7 +407,7 @@ NonnullOwnPtr<Command> parse_all_commands(char* argv[]) return make<AndCommand>(command.release_nonnull(), make<PrintCommand>()); } -const char* parse_options(int argc, char* argv[]) +static const char* parse_options(int argc, char* argv[]) { // Sadly, we can't use Core::ArgsParser, because find accepts arguments in // an extremely unusual format. We're going to try to use getopt(), though. @@ -440,7 +442,7 @@ const char* parse_options(int argc, char* argv[]) } } -void walk_tree(const char* root_path, Command& command) +static void walk_tree(const char* root_path, Command& command) { command.evaluate(root_path); diff --git a/Userland/functrace.cpp b/Userland/functrace.cpp index b431a4fbe3..97406fb08e 100644 --- a/Userland/functrace.cpp +++ b/Userland/functrace.cpp @@ -47,7 +47,7 @@ #include <string.h> #include <unistd.h> -OwnPtr<DebugSession> g_debug_session; +static OwnPtr<DebugSession> g_debug_session; static bool g_should_output_color = false; static void handle_sigint(int) @@ -58,7 +58,7 @@ static void handle_sigint(int) g_debug_session = nullptr; } -void print_function_call(String function_name, size_t depth) +static void print_function_call(String function_name, size_t depth) { for (size_t i = 0; i < depth; ++i) { printf(" "); @@ -66,7 +66,7 @@ void print_function_call(String function_name, size_t depth) printf("=> %s\n", function_name.characters()); } -void print_syscall(PtraceRegisters& regs, size_t depth) +static void print_syscall(PtraceRegisters& regs, size_t depth) { for (size_t i = 0; i < depth; ++i) { printf(" "); @@ -83,7 +83,7 @@ void print_syscall(PtraceRegisters& regs, size_t depth) end_color); } -NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code() +static NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code() { (void)demangle("foo"); // Required for linked with __cxa_demangle auto instrumented = make<HashMap<void*, X86::Instruction>>(); diff --git a/Userland/id.cpp b/Userland/id.cpp index fc0368b396..f0caa31508 100644 --- a/Userland/id.cpp +++ b/Userland/id.cpp @@ -81,7 +81,7 @@ int main(int argc, char** argv) return status; } -bool print_uid_object(uid_t uid) +static bool print_uid_object(uid_t uid) { if (flag_print_name) { struct passwd* pw = getpwuid(uid); @@ -92,7 +92,7 @@ bool print_uid_object(uid_t uid) return true; } -bool print_gid_object(gid_t gid) +static bool print_gid_object(gid_t gid) { if (flag_print_name) { struct group* gr = getgrgid(gid); @@ -102,7 +102,7 @@ bool print_gid_object(gid_t gid) return true; } -bool print_gid_list() +static bool print_gid_list() { int extra_gid_count = getgroups(0, nullptr); if (extra_gid_count) { @@ -127,7 +127,7 @@ bool print_gid_list() return true; } -bool print_full_id_list() +static bool print_full_id_list() { uid_t uid = getuid(); @@ -159,7 +159,7 @@ bool print_full_id_list() return true; } -int print_id_objects() +static int print_id_objects() { if (flag_print_uid) { if (!print_uid_object(getuid())) diff --git a/Userland/ifconfig.cpp b/Userland/ifconfig.cpp index 9711fa8ccb..98761cf248 100644 --- a/Userland/ifconfig.cpp +++ b/Userland/ifconfig.cpp @@ -38,7 +38,7 @@ #include <sys/ioctl.h> #include <sys/socket.h> -String si_bytes(unsigned bytes) +static String si_bytes(unsigned bytes) { if (bytes >= GB) return String::format("%fGiB", (double)bytes / (double)GB); diff --git a/Userland/js.cpp b/Userland/js.cpp index 42ea3705cb..66298b07da 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -82,7 +82,7 @@ static String prompt_for_level(int level) return prompt_builder.build(); } -String read_next_piece() +static String read_next_piece() { StringBuilder piece; @@ -234,7 +234,7 @@ static void print_regexp(const JS::Object& object, HashTable<JS::Object*>&) printf("\033[34;1m/%s/%s\033[0m", regexp.content().characters(), regexp.flags().characters()); } -void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects) +static void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects) { if (value.is_empty()) { printf("\033[34;1m<empty>\033[0m"); @@ -292,14 +292,14 @@ static void print(JS::Value value) putchar('\n'); } -bool file_has_shebang(AK::ByteBuffer file_contents) +static bool file_has_shebang(AK::ByteBuffer file_contents) { if (file_contents.size() >= 2 && file_contents[0] == '#' && file_contents[1] == '!') return true; return false; } -StringView strip_shebang(AK::ByteBuffer file_contents) +static StringView strip_shebang(AK::ByteBuffer file_contents) { size_t i = 0; for (i = 2; i < file_contents.size(); ++i) { @@ -309,7 +309,7 @@ StringView strip_shebang(AK::ByteBuffer file_contents) return StringView((const char*)file_contents.data() + i, file_contents.size() - i); } -bool write_to_file(const StringView& path) +static bool write_to_file(const StringView& path) { int fd = open_with_path_length(path.characters_without_null_termination(), path.length(), O_WRONLY | O_CREAT | O_TRUNC, 0666); for (size_t i = 0; i < repl_statements.size(); i++) { @@ -335,7 +335,7 @@ bool write_to_file(const StringView& path) return true; } -bool parse_and_run(JS::Interpreter& interpreter, const StringView& source) +static bool parse_and_run(JS::Interpreter& interpreter, const StringView& source) { auto parser = JS::Parser(JS::Lexer(source)); auto program = parser.parse_program(); @@ -443,7 +443,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::load_file) return JS::Value(true); } -void repl(JS::Interpreter& interpreter) +static void repl(JS::Interpreter& interpreter) { while (!s_fail_repl) { String piece = read_next_piece(); @@ -455,7 +455,7 @@ void repl(JS::Interpreter& interpreter) } static Function<void()> interrupt_interpreter; -void sigint_handler() +static void sigint_handler() { interrupt_interpreter(); } diff --git a/Userland/ls.cpp b/Userland/ls.cpp index 5fd6c45fcf..4d0e4ea993 100644 --- a/Userland/ls.cpp +++ b/Userland/ls.cpp @@ -137,7 +137,7 @@ int main(int argc, char** argv) return status; } -int print_escaped(const char* name) +static int print_escaped(const char* name) { int printed = 0; @@ -172,7 +172,7 @@ static String& hostname() return s_hostname; } -size_t print_name(const struct stat& st, const String& name, const char* path_for_link_resolution, const char* path_for_hyperlink) +static size_t print_name(const struct stat& st, const String& name, const char* path_for_link_resolution, const char* path_for_hyperlink) { if (!flag_disable_hyperlinks) { if (auto* full_path = realpath(path_for_hyperlink, nullptr)) { @@ -250,7 +250,7 @@ static String human_readable_size(size_t size) return number_string_with_one_decimal((float)size / (float)GB, "G"); } -bool print_filesystem_object(const String& path, const String& name, const struct stat& st) +static bool print_filesystem_object(const String& path, const String& name, const struct stat& st) { if (flag_show_inode) printf("%08u ", st.st_ino); @@ -318,7 +318,7 @@ bool print_filesystem_object(const String& path, const String& name, const struc return true; } -int do_file_system_object_long(const char* path) +static int do_file_system_object_long(const char* path) { Core::DirIterator di(path, !flag_show_dotfiles ? Core::DirIterator::SkipDots : Core::DirIterator::Flags::NoFlags); if (di.has_error()) { @@ -383,7 +383,7 @@ int do_file_system_object_long(const char* path) return 0; } -bool print_filesystem_object_short(const char* path, const char* name, size_t* nprinted) +static bool print_filesystem_object_short(const char* path, const char* name, size_t* nprinted) { struct stat st; int rc = lstat(path, &st); diff --git a/Userland/lsof.cpp b/Userland/lsof.cpp index 510e59c8fc..5bef9fdeed 100644 --- a/Userland/lsof.cpp +++ b/Userland/lsof.cpp @@ -42,7 +42,7 @@ struct OpenFile { String name; }; -Vector<OpenFile> get_open_files_by_pid(pid_t pid) +static Vector<OpenFile> get_open_files_by_pid(pid_t pid) { auto file = Core::File::open(String::format("/proc/%d/fds", pid), Core::IODevice::OpenMode::ReadOnly); if (file.is_error()) { @@ -69,7 +69,7 @@ Vector<OpenFile> get_open_files_by_pid(pid_t pid) return files; } -void display_entry(const OpenFile& file, const Core::ProcessStatistics& statistics) +static void display_entry(const OpenFile& file, const Core::ProcessStatistics& statistics) { printf("%-28s %4d %4d %-10s %4d %s\n", statistics.name.characters(), file.pid, statistics.pgid, statistics.username.characters(), file.fd, file.name.characters()); } diff --git a/Userland/more.cpp b/Userland/more.cpp index 2299438aa3..18270e09b9 100644 --- a/Userland/more.cpp +++ b/Userland/more.cpp @@ -31,7 +31,7 @@ static int key_fd; -void wait_for_key() +static void wait_for_key() { printf("\033[7m--[ more ]--\033[0m"); fflush(stdout); diff --git a/Userland/mount.cpp b/Userland/mount.cpp index 697c377686..c5c0e8f072 100644 --- a/Userland/mount.cpp +++ b/Userland/mount.cpp @@ -35,7 +35,7 @@ #include <string.h> #include <unistd.h> -int parse_options(const StringView& options) +static int parse_options(const StringView& options) { int flags = 0; Vector<StringView> parts = options.split_view(','); @@ -60,12 +60,12 @@ int parse_options(const StringView& options) return flags; } -bool is_source_none(const char* source) +static bool is_source_none(const char* source) { return !strcmp("none", source); } -int get_source_fd(const char* source) +static int get_source_fd(const char* source) { if (is_source_none(source)) return -1; @@ -81,7 +81,7 @@ int get_source_fd(const char* source) return fd; } -bool mount_all() +static bool mount_all() { // Mount all filesystems listed in /etc/fstab. dbg() << "Mounting all filesystems..."; @@ -139,7 +139,7 @@ bool mount_all() return all_ok; } -bool print_mounts() +static bool print_mounts() { // Output info about currently mounted filesystems. auto df = Core::File::construct("/proc/df"); diff --git a/Userland/ping.cpp b/Userland/ping.cpp index 9fb272b58c..54fbf343bd 100644 --- a/Userland/ping.cpp +++ b/Userland/ping.cpp @@ -36,7 +36,7 @@ #include <time.h> #include <unistd.h> -uint16_t internet_checksum(const void* ptr, size_t count) +static uint16_t internet_checksum(const void* ptr, size_t count) { uint32_t checksum = 0; auto* w = (const uint16_t*)ptr; diff --git a/Userland/rm.cpp b/Userland/rm.cpp index 2ef96f063e..7cd575f198 100644 --- a/Userland/rm.cpp +++ b/Userland/rm.cpp @@ -35,7 +35,7 @@ #include <sys/stat.h> #include <unistd.h> -int remove(bool recursive, bool force, String path) +static int remove(bool recursive, bool force, String path) { struct stat path_stat; if (lstat(path.characters(), &path_stat) < 0) { diff --git a/Userland/seq.cpp b/Userland/seq.cpp index cabc3d2ef1..2f6d1c40dd 100644 --- a/Userland/seq.cpp +++ b/Userland/seq.cpp @@ -30,7 +30,7 @@ #include <string.h> #include <unistd.h> -double get_double(const char* name, const char* d_string, int* number_of_decimals) +static double get_double(const char* name, const char* d_string, int* number_of_decimals) { char* end; double d = strtod(d_string, &end); diff --git a/Userland/sleep.cpp b/Userland/sleep.cpp index e0e48612da..32dd646275 100644 --- a/Userland/sleep.cpp +++ b/Userland/sleep.cpp @@ -30,7 +30,7 @@ #include <string.h> #include <unistd.h> -void handle_sigint(int) +static void handle_sigint(int) { } diff --git a/Userland/tail.cpp b/Userland/tail.cpp index 701fdbc3f4..9503357e47 100644 --- a/Userland/tail.cpp +++ b/Userland/tail.cpp @@ -36,7 +36,7 @@ #define DEFAULT_LINE_COUNT 10 -int tail_from_pos(Core::File& file, off_t startline, bool want_follow) +static int tail_from_pos(Core::File& file, off_t startline, bool want_follow) { if (!file.seek(startline + 1)) return 1; @@ -62,7 +62,7 @@ int tail_from_pos(Core::File& file, off_t startline, bool want_follow) return 0; } -off_t find_seek_pos(Core::File& file, int wanted_lines) +static off_t find_seek_pos(Core::File& file, int wanted_lines) { // Rather than reading the whole file, start at the end and work backwards, // stopping when we've found the number of lines we want. diff --git a/Userland/tree.cpp b/Userland/tree.cpp index 546d7c1d72..120bd5046e 100644 --- a/Userland/tree.cpp +++ b/Userland/tree.cpp @@ -41,7 +41,7 @@ static int max_depth = INT_MAX; static int g_directories_seen = 0; static int g_files_seen = 0; -void print_directory_tree(const String& root_path, int depth, const String& indent_string) +static void print_directory_tree(const String& root_path, int depth, const String& indent_string) { if (depth > 0) { String root_indent_string; diff --git a/Userland/unzip.cpp b/Userland/unzip.cpp index 7fc6bfd921..cf7bfaf9e9 100644 --- a/Userland/unzip.cpp +++ b/Userland/unzip.cpp @@ -33,7 +33,7 @@ static const u8 central_directory_file_header_sig[] = "\x50\x4b\x01\x02"; -bool seek_and_read(u8* buffer, const MappedFile& file, off_t seek_to, size_t bytes_to_read) +static bool seek_and_read(u8* buffer, const MappedFile& file, off_t seek_to, size_t bytes_to_read) { if (!buffer) return false; @@ -46,7 +46,7 @@ bool seek_and_read(u8* buffer, const MappedFile& file, off_t seek_to, size_t byt return true; } -bool find_next_central_directory(off_t file_size, const MappedFile& file, off_t current_index, off_t& return_index) +static bool find_next_central_directory(off_t file_size, const MappedFile& file, off_t current_index, off_t& return_index) { off_t start_index = current_index == 0 ? current_index : current_index + 1; for (off_t index = start_index; index < file_size - 4; index++) { @@ -62,7 +62,7 @@ bool find_next_central_directory(off_t file_size, const MappedFile& file, off_t return false; } -bool unpack_file_for_central_directory_index(off_t central_directory_index, const MappedFile& file) +static bool unpack_file_for_central_directory_index(off_t central_directory_index, const MappedFile& file) { enum CentralFileDirectoryHeaderOffsets { CFDHCompressionMethodOffset = 10, diff --git a/Userland/watch.cpp b/Userland/watch.cpp index a0e61c21a8..950de54fed 100644 --- a/Userland/watch.cpp +++ b/Userland/watch.cpp @@ -42,7 +42,7 @@ static bool flag_beep_on_fail = false; static volatile int exit_code = 0; static volatile pid_t child_pid = -1; -String build_header_string(const Vector<const char*>& command, const struct timeval& interval) +static String build_header_string(const Vector<const char*>& command, const struct timeval& interval) { StringBuilder builder; builder.appendf("Every %d", interval.tv_sec); @@ -52,7 +52,7 @@ String build_header_string(const Vector<const char*>& command, const struct time return builder.build(); } -struct timeval get_current_time() +static struct timeval get_current_time() { struct timespec ts; struct timeval tv; @@ -61,14 +61,14 @@ struct timeval get_current_time() return tv; } -int64_t usecs_from(const struct timeval& start, const struct timeval& end) +static int64_t usecs_from(const struct timeval& start, const struct timeval& end) { struct timeval diff; timeval_sub(end, start, diff); return 1000000 * diff.tv_sec + diff.tv_usec; } -void handle_signal(int signal) +static void handle_signal(int signal) { if (child_pid > 0) { if (kill(child_pid, signal) < 0) { @@ -84,7 +84,7 @@ void handle_signal(int signal) exit(exit_code); } -int run_command(const Vector<const char*>& command) +static int run_command(const Vector<const char*>& command) { if ((errno = posix_spawnp(const_cast<pid_t*>(&child_pid), command[0], nullptr, nullptr, const_cast<char**>(command.data()), environ))) { exit_code = 1; @@ -92,23 +92,23 @@ int run_command(const Vector<const char*>& command) return errno; } - // Wait for the child to terminate, then return its exit code. - int status; - pid_t exited_pid; - do { - exited_pid = waitpid(child_pid, &status, 0); - } while (exited_pid < 0 && errno == EINTR); - ASSERT(exited_pid == child_pid); - child_pid = -1; - if (exited_pid < 0) { - perror("waitpid"); - return 1; - } - if (WIFEXITED(status)) { - return WEXITSTATUS(status); - } else { - return 1; - } + // Wait for the child to terminate, then return its exit code. + int status; + pid_t exited_pid; + do { + exited_pid = waitpid(child_pid, &status, 0); + } while (exited_pid < 0 && errno == EINTR); + ASSERT(exited_pid == child_pid); + child_pid = -1; + if (exited_pid < 0) { + perror("waitpid"); + return 1; + } + if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else { + return 1; + } } int main(int argc, char** argv) diff --git a/Userland/wc.cpp b/Userland/wc.cpp index 2cf74e6b89..497e5e937d 100644 --- a/Userland/wc.cpp +++ b/Userland/wc.cpp @@ -44,7 +44,7 @@ bool output_line = false; bool output_byte = false; bool output_word = false; -void wc_out(Count& count) +static void wc_out(Count& count) { if (output_line) printf("%7i ", count.lines); @@ -56,7 +56,7 @@ void wc_out(Count& count) printf("%14s\n", count.name.characters()); } -Count get_count(const String& file_name) +static Count get_count(const String& file_name) { Count count; FILE* file_pointer = nullptr; @@ -86,7 +86,7 @@ Count get_count(const String& file_name) return count; } -Count get_total_count(Vector<Count>& counts) +static Count get_total_count(Vector<Count>& counts) { Count total_count { "total" }; for (auto& count : counts) { |