From 5e2a5391f9142bca773aab4c829615895b69a6b7 Mon Sep 17 00:00:00 2001 From: landley Date: Thu, 3 Aug 2006 15:41:12 +0000 Subject: Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.) git-svn-id: svn://busybox.net/trunk/busybox@15767 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- findutils/find.c | 17 +++++------------ findutils/grep.c | 9 ++------- findutils/xargs.c | 11 +---------- 3 files changed, 8 insertions(+), 29 deletions(-) (limited to 'findutils') diff --git a/findutils/find.c b/findutils/find.c index 1e15e8899..aa915fa0f 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -11,14 +11,7 @@ */ #include "busybox.h" -#include -#include -#include -#include -#include #include -#include -#include static char *pattern; #ifdef CONFIG_FEATURE_FIND_PRINT0 @@ -138,8 +131,8 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) int i; char *cmd_string = ""; for (i = 0; i < num_matches; i++) - cmd_string = bb_xasprintf("%s%s%s", cmd_string, exec_str[i], fileName); - cmd_string = bb_xasprintf("%s%s", cmd_string, exec_str[num_matches]); + cmd_string = xasprintf("%s%s%s", cmd_string, exec_str[i], fileName); + cmd_string = xasprintf("%s%s", cmd_string, exec_str[num_matches]); system(cmd_string); goto no_match; } @@ -300,7 +293,7 @@ int find_main(int argc, char **argv) bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); if (*argv[i] == ';') break; - cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); + cmd_string = xasprintf("%s %s", cmd_string, argv[i]); } if (*cmd_string == 0) @@ -311,10 +304,10 @@ int find_main(int argc, char **argv) while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) { num_matches++; exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *)); - exec_str[num_matches - 1] = bb_xstrndup(cmd_string, b_pos); + exec_str[num_matches - 1] = xstrndup(cmd_string, b_pos); cmd_string += b_pos + 2; } - exec_str[num_matches] = bb_xstrdup(cmd_string); + exec_str[num_matches] = xstrdup(cmd_string); exec_opt = 1; #endif } else diff --git a/findutils/grep.c b/findutils/grep.c index ecb1d0457..b53bf490a 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -17,11 +17,6 @@ */ #include "busybox.h" -#include -#include -#include -#include -#include #include "xregex.h" @@ -203,7 +198,7 @@ static int grep_file(FILE *file) /* Add the line to the circular 'before' buffer */ if(lines_before) { free(before_buf[curpos]); - before_buf[curpos] = bb_xstrdup(line); + before_buf[curpos] = xstrdup(line); curpos = (curpos + 1) % lines_before; } } @@ -271,7 +266,7 @@ static void load_regexes_from_file(llist_t *fopt) fopt = cur->link; free(cur); - f = bb_xfopen(ffile, "r"); + f = xfopen(ffile, "r"); while ((line = bb_get_chomped_line_from_file(f)) != NULL) { llist_add_to(&pattern_head, new_grep_list_data(line, PATTERN_MEM_A)); diff --git a/findutils/xargs.c b/findutils/xargs.c index c3a892695..e46708303 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c @@ -18,15 +18,6 @@ */ #include "busybox.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include /* COMPAT: SYSV version defaults size (and has a max value of) to 470. We try to make it as large as possible. */ @@ -300,7 +291,7 @@ static int xargs_ask_confirmation(void) int c, savec; if (!tty_stream) { - tty_stream = bb_xfopen(CURRENT_TTY, "r"); + tty_stream = xfopen(CURRENT_TTY, "r"); /* pranoidal security by vodz */ fcntl(fileno(tty_stream), F_SETFD, FD_CLOEXEC); } -- cgit v1.2.3-55-g6feb