From a1c2ac9a200a3c40a373a6cef97c0c96fdfb2c09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 7 Feb 2008 12:55:00 +0000 Subject: [PATCH] Use "do...while (0)", not "if (1)..else" in macro definitions. --- src/ChangeLog | 5 +++++ src/character.h | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 396ce321f72..8afc3ae7426 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,11 @@ * syntax.h (SETUP_SYNTAX_TABLE): (SETUP_SYNTAX_TABLE_FOR_OBJECT): Likewise. * buffer.h (DECODE_POSITION): Likewise. + * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise. + (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE): Likewise. + (FETCH_STRING_CHAR_ADVANCE_NO_CHECK): Likewise. + (FETCH_CHAR_ADVANCE): Likewise. + (FETCH_CHAR_ADVANCE_NO_CHECK): Likewise. 2008-02-07 Jim Meyering diff --git a/src/character.h b/src/character.h index 5afa9a796dc..60bd1f43f77 100644 --- a/src/character.h +++ b/src/character.h @@ -380,7 +380,7 @@ extern char unibyte_has_multibyte_table[256]; we increment them past the character fetched. */ #define FETCH_STRING_CHAR_ADVANCE(OUTPUT, STRING, CHARIDX, BYTEIDX) \ - if (1) \ + do \ { \ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ @@ -394,13 +394,13 @@ extern char unibyte_has_multibyte_table[256]; else \ OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \ } \ - else + while (0) /* Like FETCH_STRING_CHAR_ADVANCE but return a multibyte character eve if STRING is unibyte. */ #define FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE(OUTPUT, STRING, CHARIDX, BYTEIDX) \ - if (1) \ + do \ { \ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ @@ -417,13 +417,13 @@ extern char unibyte_has_multibyte_table[256]; MAKE_CHAR_MULTIBYTE (OUTPUT); \ } \ } \ - else + while (0) /* Like FETCH_STRING_CHAR_ADVANCE but assumes STRING is multibyte. */ #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ - if (1) \ + do \ { \ unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \ int len; \ @@ -432,14 +432,14 @@ extern char unibyte_has_multibyte_table[256]; BYTEIDX += len; \ CHARIDX++; \ } \ - else + while (0) /* Like FETCH_STRING_CHAR_ADVANCE but fetch character from the current buffer. */ #define FETCH_CHAR_ADVANCE(OUTPUT, CHARIDX, BYTEIDX) \ - if (1) \ + do \ { \ CHARIDX++; \ if (!NILP (current_buffer->enable_multibyte_characters)) \ @@ -456,13 +456,13 @@ extern char unibyte_has_multibyte_table[256]; BYTEIDX++; \ } \ } \ - else + while (0) /* Like FETCH_CHAR_ADVANCE but assumes the current buffer is multibyte. */ #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ - if (1) \ + do \ { \ unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ int len; \ @@ -471,7 +471,7 @@ extern char unibyte_has_multibyte_table[256]; BYTEIDX += len; \ CHARIDX++; \ } \ - else + while (0) /* Increase the buffer byte position POS_BYTE of the current buffer to -- 2.39.5