From d921b2ecc0d294ad4bf8c7458fc52a60c28727d2 Mon Sep 17 00:00:00 2001 From: Rob 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.) --- coreutils/diff.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'coreutils/diff.c') diff --git a/coreutils/diff.c b/coreutils/diff.c index 368efd383..22c157412 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c @@ -12,23 +12,6 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "busybox.h" #define FSIZE_MAX 32768 @@ -917,21 +900,21 @@ static int diffreg(char *ofile1, char *ofile2, int flags) goto closem; if (flags & D_EMPTY1) - f1 = bb_xfopen(bb_dev_null, "r"); + f1 = xfopen(bb_dev_null, "r"); else { if (strcmp(file1, "-") == 0) f1 = stdin; else - f1 = bb_xfopen(file1, "r"); + f1 = xfopen(file1, "r"); } if (flags & D_EMPTY2) - f2 = bb_xfopen(bb_dev_null, "r"); + f2 = xfopen(bb_dev_null, "r"); else { if (strcmp(file2, "-") == 0) f2 = stdin; else - f2 = bb_xfopen(file2, "r"); + f2 = xfopen(file2, "r"); } if ((i = files_differ(f1, f2, flags)) == 0) @@ -1004,19 +987,19 @@ static void do_diff(char *dir1, char *path1, char *dir2, char *path2) int flags = D_HEADER; int val; - char *fullpath1 = bb_xasprintf("%s/%s", dir1, path1); - char *fullpath2 = bb_xasprintf("%s/%s", dir2, path2); + char *fullpath1 = xasprintf("%s/%s", dir1, path1); + char *fullpath2 = xasprintf("%s/%s", dir2, path2); if (stat(fullpath1, &stb1) != 0) { flags |= D_EMPTY1; memset(&stb1, 0, sizeof(stb1)); - fullpath1 = bb_xasprintf("%s/%s", dir1, path2); + fullpath1 = xasprintf("%s/%s", dir1, path2); } if (stat(fullpath2, &stb2) != 0) { flags |= D_EMPTY2; memset(&stb2, 0, sizeof(stb2)); stb2.st_mode = stb1.st_mode; - fullpath2 = bb_xasprintf("%s/%s", dir2, path1); + fullpath2 = xasprintf("%s/%s", dir2, path1); } if (stb1.st_mode == 0) @@ -1051,7 +1034,7 @@ static int add_to_dirlist(const char *filename, { dl_count++; dl = xrealloc(dl, dl_count * sizeof(char *)); - dl[dl_count - 1] = bb_xstrdup(filename); + dl[dl_count - 1] = xstrdup(filename); if (cmd_flags & FLAG_r) { int *pp = (int *) userdata; int path_len = *pp + 1; @@ -1077,7 +1060,7 @@ static char **get_dir(char *path) int path_len = strlen(path); void *userdata = &path_len; - /* Reset dl_count - there's no need to free dl as bb_xrealloc does + /* Reset dl_count - there's no need to free dl as xrealloc does * the job nicely. */ dl_count = 0; @@ -1089,7 +1072,7 @@ static char **get_dir(char *path) DIR *dp; struct dirent *ep; - dp = bb_opendir(path); + dp = warn_opendir(path); while ((ep = readdir(dp))) { if ((!strcmp(ep->d_name, "..")) || (!strcmp(ep->d_name, "."))) continue; @@ -1104,7 +1087,7 @@ static char **get_dir(char *path) /* Copy dl so that we can return it. */ retval = xmalloc(dl_count * sizeof(char *)); for (i = 0; i < dl_count; i++) - retval[i] = bb_xstrdup(dl[i]); + retval[i] = xstrdup(dl[i]); return retval; } -- cgit v1.2.3