summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenys Vlasenko2010-01-20 02:51:09 +0100
committerDenys Vlasenko2010-01-20 02:51:09 +0100
commit94ca6943bc5266b0f3e6fc180814e184d7502442 (patch)
tree5034cffc64f6679c4478eabb6a37100c57cbc9cd /editors
parent0d478334b3e6f644f26518c31117b25134a2678a (diff)
downloadbusybox-94ca6943bc5266b0f3e6fc180814e184d7502442.zip
busybox-94ca6943bc5266b0f3e6fc180814e184d7502442.tar.gz
*: small code shrinks and compile fix for unicode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/diff.c9
-rw-r--r--editors/patch.c3
2 files changed, 6 insertions, 6 deletions
diff --git a/editors/diff.c b/editors/diff.c
index 9110982..2e3a455 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -432,7 +432,8 @@ static NOINLINE int *create_J(FILE_and_pos_t ft[2], int nlen[2], off_t *ix[2])
token_t tok;
size_t sz = 100;
nfile[i] = xmalloc((sz + 3) * sizeof(nfile[i][0]));
- fseeko(ft[i].ft_fp, 0, SEEK_SET); /* ft gets here without the correct position */
+ /* ft gets here without the correct position, cant use seek_ft */
+ fseeko(ft[i].ft_fp, 0, SEEK_SET);
nlen[i] = 0;
/* We could zalloc nfile, but then zalloc starts showing in gprof at ~1% */
@@ -625,7 +626,7 @@ static bool diff(FILE* fp[2], char *file[2])
}
if (idx < 0)
continue;
- if (!(option_mask32 & FLAG(q)) && !((option_mask32 & FLAG(B)) && !nonempty)) {
+ if (!(option_mask32 & (FLAG(q)+FLAG(B))) && !nonempty) {
struct context_vec *cvp = vec;
int lowa = MAX(1, cvp->a - opt_U_context);
int upb = MIN(nlen[0], vec[idx].b + opt_U_context);
@@ -634,8 +635,8 @@ static bool diff(FILE* fp[2], char *file[2])
if (!anychange) {
/* Print the context/unidiff header first time through */
- printf("--- %s\n", label[0] ?: file[0]);
- printf("+++ %s\n", label[1] ?: file[1]);
+ printf("--- %s\n", label[0] ? label[0] : file[0]);
+ printf("+++ %s\n", label[1] ? label[1] : file[1]);
}
printf("@@ -");
diff --git a/editors/patch.c b/editors/patch.c
index ab3af3c..b36980f 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -85,7 +85,6 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
{
const char *p = "-1";
const char *i = "-"; /* compat */
- const char *g; /* unimplemented, default is "0" */
#if ENABLE_LONG_OPTS
static const char patch_longopts[] ALIGN1 =
"strip\0" Required_argument "p"
@@ -97,7 +96,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
;
applet_long_options = patch_longopts;
#endif
- opt = getopt32(argv, "p:i:RNg:", &p, &i, &g);
+ opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL);
if (opt & OPT_R)
plus = '-';
patch_level = xatoi(p); /* can be negative! */