diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-22 09:20:45 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-22 09:20:45 -0700 |
| commit | 8abc3f12955673bdb367b2de5556ff66f202d2d0 (patch) | |
| tree | 0555a165d49f0900c1be467857a89d46cebabbd2 /src | |
| parent | a2d26660368fbe4cc7d103aad6f565e36a280fac (diff) | |
* coding.c (encode_coding_raw_text): Avoid unnecessary test
the first time through the loop, since we know p0 < p1 then.
This also avoids a gcc -Wstrict-overflow warning.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/coding.c | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a341d1b4678..45982f607f4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-22 Paul Eggert <eggert@cs.ucla.edu> + * coding.c (encode_coding_raw_text): Avoid unnecessary test + the first time through the loop, since we know p0 < p1 then. + This also avoids a gcc -Wstrict-overflow warning. + * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow leading to a memory leak, possible in functions like load_charset_map_from_file that can allocate an unbounded number diff --git a/src/coding.c b/src/coding.c index 0c2836c19f6..0596d16bf46 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5266,11 +5266,12 @@ encode_coding_raw_text (struct coding_system *coding) unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; CHAR_STRING_ADVANCE (c, p1); - while (p0 < p1) + do { EMIT_ONE_BYTE (*p0); p0++; } + while (p0 < p1); } } else |
