canonicalize nano-2.0.9-warnings.patch

This commit is contained in:
Kamil Dudka 2009-11-05 16:39:52 +00:00
parent 61f7bd616f
commit 2b039262d7

View File

@ -1,26 +1,25 @@
diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
--- nano-2.0.9.orig/src/chars.c 2008-04-02 05:49:33.000000000 +0200
+++ nano-2.0.9/src/chars.c 2009-09-21 13:22:25.976235192 +0200
@@ -79,6 +79,18 @@ bool is_byte(int c)
diff --git a/src/chars.c b/src/chars.c
index 0061621..14c1267 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -79,6 +79,16 @@ bool is_byte(int c)
return ((unsigned int)c == (unsigned char)c);
}
+static void mbtowc_reset(void)
+{
+ int rv = mbtowc(NULL, NULL, 0);
+ (void) rv;
+ IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
+}
+
+static void wctomb_reset(void)
+{
+ int rv = wctomb(NULL, 0);
+ (void) rv;
+ IGNORE_CALL_RESULT(wctomb(NULL, 0));
+}
+
/* This function is equivalent to isalnum() for multibyte characters. */
bool is_alnum_mbchar(const char *c)
{
@@ -89,7 +101,7 @@ bool is_alnum_mbchar(const char *c)
@@ -89,7 +99,7 @@ bool is_alnum_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
@ -29,7 +28,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = bad_wchar;
}
@@ -109,7 +121,7 @@ bool is_blank_mbchar(const char *c)
@@ -109,7 +119,7 @@ bool is_blank_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
@ -38,7 +37,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = bad_wchar;
}
@@ -156,7 +168,7 @@ bool is_cntrl_mbchar(const char *c)
@@ -156,7 +166,7 @@ bool is_cntrl_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
@ -47,7 +46,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = bad_wchar;
}
@@ -177,7 +189,7 @@ bool is_punct_mbchar(const char *c)
@@ -177,7 +187,7 @@ bool is_punct_mbchar(const char *c)
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
@ -56,7 +55,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = bad_wchar;
}
@@ -243,14 +255,14 @@ char *control_mbrep(const char *c, char
@@ -243,14 +253,14 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
@ -73,7 +72,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
*crep_len = 0;
}
}
@@ -278,14 +290,14 @@ char *mbrep(const char *c, char *crep, i
@@ -278,14 +288,14 @@ char *mbrep(const char *c, char *crep, int *crep_len)
/* Reject invalid Unicode characters. */
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
@ -90,7 +89,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
*crep_len = 0;
}
}
@@ -311,7 +323,7 @@ int mbwidth(const char *c)
@@ -311,7 +321,7 @@ int mbwidth(const char *c)
int width;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
@ -99,7 +98,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = bad_wchar;
}
@@ -356,7 +368,7 @@ char *make_mbchar(long chr, int *chr_mb_
@@ -356,7 +366,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
/* Reject invalid Unicode characters. */
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
@ -108,17 +107,16 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
*chr_mb_len = 0;
}
} else {
@@ -388,7 +400,8 @@ int parse_mbchar(const char *buf, char *
@@ -388,7 +398,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
/* If buf contains an invalid multibyte character, only
* interpret buf's first byte. */
if (buf_mb_len < 0) {
- mblen(NULL, 0);
+ int rv = mblen(NULL, 0);
+ (void) rv;
+ IGNORE_CALL_RESULT(mblen(NULL, 0));
buf_mb_len = 1;
} else if (buf_mb_len == 0)
buf_mb_len++;
@@ -545,7 +558,7 @@ int mbstrncasecmp(const char *s1, const
@@ -545,7 +555,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
@ -127,7 +125,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
ws1 = (unsigned char)*s1_mb;
bad_s1_mb = TRUE;
}
@@ -553,7 +566,7 @@ int mbstrncasecmp(const char *s1, const
@@ -553,7 +563,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
@ -136,7 +134,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
ws2 = (unsigned char)*s2_mb;
bad_s2_mb = TRUE;
}
@@ -781,7 +794,7 @@ char *mbstrchr(const char *s, const char
@@ -781,7 +791,7 @@ char *mbstrchr(const char *s, const char *c)
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
@ -145,7 +143,7 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
wc = (unsigned char)*c;
bad_c_mb = TRUE;
}
@@ -790,7 +803,7 @@ char *mbstrchr(const char *s, const char
@@ -790,7 +800,7 @@ char *mbstrchr(const char *s, const char *c)
int s_mb_len = parse_mbchar(s, s_mb, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
@ -154,81 +152,23 @@ diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
ws = (unsigned char)*s;
bad_s_mb = TRUE;
}
diff -rup nano-2.0.9.orig/src/files.c nano-2.0.9/src/files.c
--- nano-2.0.9.orig/src/files.c 2008-08-24 07:49:25.000000000 +0200
+++ nano-2.0.9/src/files.c 2009-09-21 13:24:50.585047697 +0200
@@ -1057,6 +1057,7 @@ char *get_full_path(const char *origpath
free(d_there);
d_there = NULL;
} else {
+ int rv;
free(d_there);
/* Get the full path. */
@@ -1082,7 +1083,8 @@ char *get_full_path(const char *origpath
diff --git a/src/files.c b/src/files.c
index 9840ec7..923b787 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1082,7 +1082,7 @@ char *get_full_path(const char *origpath)
/* Finally, go back to the path specified in d_here,
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
- chdir(d_here);
+ rv = chdir(d_here);
+ (void) rv;
/* Free d_here, since we're done using it. */
free(d_here);
diff -rup nano-2.0.9.orig/src/chars.c nano-2.0.9/src/chars.c
--- nano-2.0.9.orig/src/chars.c 2009-09-21 21:23:45.682379298 +0200
+++ nano-2.0.9/src/chars.c 2009-09-21 21:28:50.143093880 +0200
@@ -81,14 +81,12 @@ bool is_byte(int c)
static void mbtowc_reset(void)
{
- int rv = mbtowc(NULL, NULL, 0);
- (void) rv;
+ IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
}
static void wctomb_reset(void)
{
- int rv = wctomb(NULL, 0);
- (void) rv;
+ IGNORE_CALL_RESULT(wctomb(NULL, 0));
}
/* This function is equivalent to isalnum() for multibyte characters. */
@@ -400,8 +398,7 @@ int parse_mbchar(const char *buf, char *
/* If buf contains an invalid multibyte character, only
* interpret buf's first byte. */
if (buf_mb_len < 0) {
- int rv = mblen(NULL, 0);
- (void) rv;
+ IGNORE_CALL_RESULT(mblen(NULL, 0));
buf_mb_len = 1;
} else if (buf_mb_len == 0)
buf_mb_len++;
diff -rup nano-2.0.9.orig/src/files.c nano-2.0.9/src/files.c
--- nano-2.0.9.orig/src/files.c 2009-09-21 21:23:45.683422811 +0200
+++ nano-2.0.9/src/files.c 2009-09-21 21:29:11.684110349 +0200
@@ -1057,7 +1057,6 @@ char *get_full_path(const char *origpath
free(d_there);
d_there = NULL;
} else {
- int rv;
free(d_there);
/* Get the full path. */
@@ -1083,8 +1082,7 @@ char *get_full_path(const char *origpath
/* Finally, go back to the path specified in d_here,
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
- rv = chdir(d_here);
- (void) rv;
+ IGNORE_CALL_RESULT(chdir(d_here));
/* Free d_here, since we're done using it. */
free(d_here);
diff -rup nano-2.0.9.orig/src/nano.h nano-2.0.9/src/nano.h
--- nano-2.0.9.orig/src/nano.h 2008-04-02 05:49:33.000000000 +0200
+++ nano-2.0.9/src/nano.h 2009-09-21 21:27:50.795110162 +0200
diff --git a/src/nano.h b/src/nano.h
index 195f548..2f1796b 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -44,6 +44,9 @@
#include <sys/param.h>
#endif