diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2010-02-04 04:04:56 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 04:04:56 +0100 |
commit | 1821d188ca674b42bf0f384b0c2332ff95701bba (patch) | |
tree | 7666fd803fadc230f3d2bb7df9a908aff0a231b1 | |
parent | f111b67100d17e0dab904160a0ab18430a70b9ba (diff) | |
download | busybox-w32-1821d188ca674b42bf0f384b0c2332ff95701bba.tar.gz busybox-w32-1821d188ca674b42bf0f384b0c2332ff95701bba.tar.bz2 busybox-w32-1821d188ca674b42bf0f384b0c2332ff95701bba.zip |
diff: more compiler compat fixes. no code changes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Makefile.flags | 1 | ||||
-rw-r--r-- | editors/diff.c | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Makefile.flags b/Makefile.flags index 032f6c135..60bb888d8 100644 --- a/Makefile.flags +++ b/Makefile.flags | |||
@@ -40,6 +40,7 @@ CFLAGS += $(call cc-option,-Werror,) | |||
40 | ## Classic *(off_t*)(void*)ptr does not work, | 40 | ## Classic *(off_t*)(void*)ptr does not work, |
41 | ## and I am unwilling to do crazy gcc specific ({ void *ppp = ...; }) | 41 | ## and I am unwilling to do crazy gcc specific ({ void *ppp = ...; }) |
42 | ## stuff in macros. This would obfuscate the code too much. | 42 | ## stuff in macros. This would obfuscate the code too much. |
43 | ## Maybe try __attribute__((__may_alias__))? | ||
43 | #CFLAGS += $(call cc-ifversion, -eq, 0404, -fno-strict-aliasing) | 44 | #CFLAGS += $(call cc-ifversion, -eq, 0404, -fno-strict-aliasing) |
44 | endif | 45 | endif |
45 | # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() | 46 | # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() |
diff --git a/editors/diff.c b/editors/diff.c index a8ffcdd8d..07594e8d8 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -471,7 +471,7 @@ start: | |||
471 | ix[i][j] = nfile[i][j].offset; | 471 | ix[i][j] = nfile[i][j].offset; |
472 | } | 472 | } |
473 | 473 | ||
474 | /* lenght of prefix and suffix is calculated */ | 474 | /* length of prefix and suffix is calculated */ |
475 | for (; pref < nlen[0] && pref < nlen[1] && | 475 | for (; pref < nlen[0] && pref < nlen[1] && |
476 | nfile[0][pref + 1].value == nfile[1][pref + 1].value; | 476 | nfile[0][pref + 1].value == nfile[1][pref + 1].value; |
477 | pref++); | 477 | pref++); |
@@ -501,7 +501,7 @@ start: | |||
501 | free(nfile[1]); | 501 | free(nfile[1]); |
502 | 502 | ||
503 | class = xmalloc((slen[0] + 1) * sizeof(class[0])); | 503 | class = xmalloc((slen[0] + 1) * sizeof(class[0])); |
504 | for (int i = 1; i <= slen[0]; i++) /* Unsorting */ | 504 | for (i = 1; i <= slen[0]; i++) /* Unsorting */ |
505 | class[sfile[0][i].serial] = sfile[0][i].value; | 505 | class[sfile[0][i].serial] = sfile[0][i].value; |
506 | free(nfile[0]); | 506 | free(nfile[0]); |
507 | #else | 507 | #else |
@@ -565,7 +565,7 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
565 | FILE_and_pos_t ft[2]; | 565 | FILE_and_pos_t ft[2]; |
566 | typedef struct { int a, b; } vec_t[2]; | 566 | typedef struct { int a, b; } vec_t[2]; |
567 | vec_t *vec = NULL; | 567 | vec_t *vec = NULL; |
568 | int i = 1, idx = -1; | 568 | int i = 1, j, k, idx = -1; |
569 | bool anychange = false; | 569 | bool anychange = false; |
570 | int *J; | 570 | int *J; |
571 | 571 | ||
@@ -608,8 +608,8 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
608 | break; | 608 | break; |
609 | } | 609 | } |
610 | 610 | ||
611 | for (int j = 0; j < 2; j++) | 611 | for (j = 0; j < 2; j++) |
612 | for (int k = v[j].a; k < v[j].b; k++) | 612 | for (k = v[j].a; k < v[j].b; k++) |
613 | nonempty |= (ix[j][k+1] - ix[j][k] != 1); | 613 | nonempty |= (ix[j][k+1] - ix[j][k] != 1); |
614 | 614 | ||
615 | vec = xrealloc_vector(vec, 6, ++idx); | 615 | vec = xrealloc_vector(vec, 6, ++idx); |
@@ -624,6 +624,7 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
624 | if (idx < 0 || ((option_mask32 & FLAG(B)) && !nonempty)) | 624 | if (idx < 0 || ((option_mask32 & FLAG(B)) && !nonempty)) |
625 | goto cont; | 625 | goto cont; |
626 | if (!(option_mask32 & FLAG(q))) { | 626 | if (!(option_mask32 & FLAG(q))) { |
627 | int lowa; | ||
627 | vec_t span, *cvp = vec; | 628 | vec_t span, *cvp = vec; |
628 | 629 | ||
629 | if (!anychange) { | 630 | if (!anychange) { |
@@ -633,7 +634,7 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
633 | } | 634 | } |
634 | 635 | ||
635 | printf("@@"); | 636 | printf("@@"); |
636 | for (int j = 0; j < 2; j++) { | 637 | for (j = 0; j < 2; j++) { |
637 | int a = span[j].a = MAX(1, (*cvp)[j].a - opt_U_context); | 638 | int a = span[j].a = MAX(1, (*cvp)[j].a - opt_U_context); |
638 | int b = span[j].b = MIN(nlen[j], vec[idx][j].b + opt_U_context); | 639 | int b = span[j].b = MIN(nlen[j], vec[idx][j].b + opt_U_context); |
639 | 640 | ||
@@ -647,12 +648,12 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
647 | * Output changes in "unified" diff format--the old and new lines | 648 | * Output changes in "unified" diff format--the old and new lines |
648 | * are printed together. | 649 | * are printed together. |
649 | */ | 650 | */ |
650 | for (int lowa = span[0].a; ; lowa = (*cvp++)[0].b + 1) { | 651 | for (lowa = span[0].a; ; lowa = (*cvp++)[0].b + 1) { |
651 | bool end = cvp > &vec[idx]; | 652 | bool end = cvp > &vec[idx]; |
652 | fetch(&ft[0], ix[0], lowa, end ? span[0].b : (*cvp)[0].a - 1, ' '); | 653 | fetch(&ft[0], ix[0], lowa, end ? span[0].b : (*cvp)[0].a - 1, ' '); |
653 | if (end) | 654 | if (end) |
654 | break; | 655 | break; |
655 | for (int j = 0; j < 2; j++) | 656 | for (j = 0; j < 2; j++) |
656 | fetch(&ft[j], ix[j], (*cvp)[j].a, (*cvp)[j].b, j ? '+' : '-'); | 657 | fetch(&ft[j], ix[j], (*cvp)[j].a, (*cvp)[j].b, j ? '+' : '-'); |
657 | } | 658 | } |
658 | } | 659 | } |