rename obstack_grow_symbol=>obstack_grow_utf8
authorMatthias Braun <matze@braunis.de>
Sun, 27 May 2012 21:44:25 +0000 (23:44 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 17 Jun 2012 15:09:25 +0000 (17:09 +0200)
This is more logical name since we don't put symbol_t on the obstack but a
unicode character in utf8 encoding.

lexer.c
preprocessor.c
unicode.h

diff --git a/lexer.c b/lexer.c
index 0212cfc..1f0c23d 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -377,7 +377,7 @@ universal:
                                } else if (obstack_object_size(&symbol_obstack) == 0 && !is_universal_char_valid_identifier_start(v)) {
                                        errorf(&lexer_pos, "universal character \\%c%0*X is not valid as start of an identifier", n == 4 ? 'u' : 'U', (int)n, v);
                                } else {
-                                       obstack_grow_symbol(&symbol_obstack, v);
+                                       obstack_grow_utf8(&symbol_obstack, v);
                                }
                                break;
                        }
@@ -601,7 +601,7 @@ static void parse_string(utf32 const delim, token_kind_t const kind, string_enco
                                }
                                obstack_1grow(&symbol_obstack, tc);
                        } else {
-                               obstack_grow_symbol(&symbol_obstack, tc);
+                               obstack_grow_utf8(&symbol_obstack, tc);
                        }
                        break;
                }
@@ -619,7 +619,7 @@ static void parse_string(utf32 const delim, token_kind_t const kind, string_enco
                                next_char();
                                goto end_of_string;
                        } else {
-                               obstack_grow_symbol(&symbol_obstack, c);
+                               obstack_grow_utf8(&symbol_obstack, c);
                                next_char();
                                break;
                        }
index e49390a..21f63b2 100644 (file)
@@ -479,7 +479,7 @@ static void parse_string(utf32 const delimiter, token_kind_t const kind,
                                        }
                                        obstack_1grow(&symbol_obstack, tc);
                                } else {
-                                       obstack_grow_symbol(&symbol_obstack, tc);
+                                       obstack_grow_utf8(&symbol_obstack, tc);
                                }
                        } else {
                                obstack_1grow(&symbol_obstack, (char)input.c);
@@ -507,7 +507,7 @@ static void parse_string(utf32 const delimiter, token_kind_t const kind,
                                next_char();
                                goto end_of_string;
                        } else {
-                               obstack_grow_symbol(&symbol_obstack, input.c);
+                               obstack_grow_utf8(&symbol_obstack, input.c);
                                next_char();
                                break;
                        }
index 18b19d5..44a9b92 100644 (file)
--- a/unicode.h
+++ b/unicode.h
@@ -45,22 +45,22 @@ static inline utf32 read_utf8_char(const char **p)
        return result;
 }
 
-static inline void obstack_grow_symbol(struct obstack *obstack, utf32 const tc)
+static inline void obstack_grow_utf8(struct obstack *const obst, utf32 const c)
 {
-       if (tc < 0x80U) {
-               obstack_1grow(obstack, tc);
-       } else if (tc < 0x800) {
-               obstack_1grow(obstack, 0xC0 | (tc >> 6));
-               obstack_1grow(obstack, 0x80 | (tc & 0x3F));
-       } else if (tc < 0x10000) {
-               obstack_1grow(obstack, 0xE0 | ( tc >> 12));
-               obstack_1grow(obstack, 0x80 | ((tc >>  6) & 0x3F));
-               obstack_1grow(obstack, 0x80 | ( tc        & 0x3F));
+       if (c < 0x80U) {
+               obstack_1grow(obstc);
+       } else if (c < 0x800) {
+               obstack_1grow(obst, 0xC0 | (c >> 6));
+               obstack_1grow(obst, 0x80 | (c & 0x3F));
+       } else if (c < 0x10000) {
+               obstack_1grow(obst, 0xE0 | ( c >> 12));
+               obstack_1grow(obst, 0x80 | ((c >>  6) & 0x3F));
+               obstack_1grow(obst, 0x80 | ( c        & 0x3F));
        } else {
-               obstack_1grow(obstack, 0xF0 | ( tc >> 18));
-               obstack_1grow(obstack, 0x80 | ((tc >> 12) & 0x3F));
-               obstack_1grow(obstack, 0x80 | ((tc >>  6) & 0x3F));
-               obstack_1grow(obstack, 0x80 | ( tc        & 0x3F));
+               obstack_1grow(obst, 0xF0 | ( c >> 18));
+               obstack_1grow(obst, 0x80 | ((c >> 12) & 0x3F));
+               obstack_1grow(obst, 0x80 | ((c >>  6) & 0x3F));
+               obstack_1grow(obst, 0x80 | ( c        & 0x3F));
        }
 }